diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..048a39c Binary files /dev/null and b/.DS_Store differ diff --git a/Xcode Templates/.DS_Store b/Xcode Templates/.DS_Store new file mode 100644 index 0000000..038fb4d Binary files /dev/null and b/Xcode Templates/.DS_Store differ diff --git a/Xcode Templates/Business Logic.xctemplate/.DS_Store b/Xcode Templates/Business Logic.xctemplate/.DS_Store new file mode 100644 index 0000000..26b3990 Binary files /dev/null and b/Xcode Templates/Business Logic.xctemplate/.DS_Store differ diff --git a/Xcode Templates/Business Logic.xctemplate/TemplateIcon.png b/Xcode Templates/Business Logic.xctemplate/TemplateIcon.png new file mode 100644 index 0000000..e885da0 Binary files /dev/null and b/Xcode Templates/Business Logic.xctemplate/TemplateIcon.png differ diff --git a/Xcode Templates/Business Logic.xctemplate/TemplateIcon@2x.png b/Xcode Templates/Business Logic.xctemplate/TemplateIcon@2x.png new file mode 100644 index 0000000..8eda5e5 Binary files /dev/null and b/Xcode Templates/Business Logic.xctemplate/TemplateIcon@2x.png differ diff --git a/Xcode Templates/Business Logic.xctemplate/TemplateInfo.plist b/Xcode Templates/Business Logic.xctemplate/TemplateInfo.plist new file mode 100644 index 0000000..09ff2e8 --- /dev/null +++ b/Xcode Templates/Business Logic.xctemplate/TemplateInfo.plist @@ -0,0 +1,39 @@ + + + + + Kind + Xcode.IDEFoundation.TextSubstitutionFileTemplateKind + Description + Default business logic implementation + Summary + Creates minimum default files and implementation for business logic + SortOrder + 30 + AllowedTypes + + public.swift-source + + DefaultCompletionName + File + MainTemplateFile + ___FILEBASENAME___.swift + Options + + + Identifier + productName + Required + + Name + Filebase: + Description + The name base of the objects to create + Type + text + Default + FileBase + + + + diff --git a/Xcode Templates/Business Logic.xctemplate/___FILEBASENAME___Interactor.swift b/Xcode Templates/Business Logic.xctemplate/___FILEBASENAME___Interactor.swift new file mode 100644 index 0000000..41cfdd0 --- /dev/null +++ b/Xcode Templates/Business Logic.xctemplate/___FILEBASENAME___Interactor.swift @@ -0,0 +1,29 @@ +// +// ___FILENAME___ +// ___PROJECTNAME___ +// +// Created by ___FULLUSERNAME___ on ___DATE___. +//___COPYRIGHT___ +// + +import Foundation + +class ___FILEBASENAMEASIDENTIFIER___ +{ + // MARK: - Property + + var output: ___VARIABLE_productName:identifier___InteractorOutput? = nil + + // MARK: - Life cycle + + init() { + + } +} + +// MARK: - Presenter Input + +extension ___FILEBASENAMEASIDENTIFIER___: ___VARIABLE_productName:identifier___InteractorInput +{ + +} diff --git a/Xcode Templates/Business Logic.xctemplate/___FILEBASENAME___InteractorInput.swift b/Xcode Templates/Business Logic.xctemplate/___FILEBASENAME___InteractorInput.swift new file mode 100644 index 0000000..552929e --- /dev/null +++ b/Xcode Templates/Business Logic.xctemplate/___FILEBASENAME___InteractorInput.swift @@ -0,0 +1,14 @@ +// +// ___FILENAME___ +// ___PROJECTNAME___ +// +// Created by ___FULLUSERNAME___ on ___DATE___. +//___COPYRIGHT___ +// + +import Foundation + +protocol ___FILEBASENAMEASIDENTIFIER___ +{ + +} diff --git a/Xcode Templates/Business Logic.xctemplate/___FILEBASENAME___InteractorOutput.swift b/Xcode Templates/Business Logic.xctemplate/___FILEBASENAME___InteractorOutput.swift new file mode 100644 index 0000000..552929e --- /dev/null +++ b/Xcode Templates/Business Logic.xctemplate/___FILEBASENAME___InteractorOutput.swift @@ -0,0 +1,14 @@ +// +// ___FILENAME___ +// ___PROJECTNAME___ +// +// Created by ___FULLUSERNAME___ on ___DATE___. +//___COPYRIGHT___ +// + +import Foundation + +protocol ___FILEBASENAMEASIDENTIFIER___ +{ + +} diff --git a/Xcode Templates/Integration Test.xctemplate/.DS_Store b/Xcode Templates/Integration Test.xctemplate/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/Xcode Templates/Integration Test.xctemplate/.DS_Store differ diff --git a/Xcode Templates/Integration Test.xctemplate/TemplateIcon.png b/Xcode Templates/Integration Test.xctemplate/TemplateIcon.png new file mode 100644 index 0000000..e885da0 Binary files /dev/null and b/Xcode Templates/Integration Test.xctemplate/TemplateIcon.png differ diff --git a/Xcode Templates/Integration Test.xctemplate/TemplateIcon@2x.png b/Xcode Templates/Integration Test.xctemplate/TemplateIcon@2x.png new file mode 100644 index 0000000..8eda5e5 Binary files /dev/null and b/Xcode Templates/Integration Test.xctemplate/TemplateIcon@2x.png differ diff --git a/Xcode Templates/Integration Test.xctemplate/TemplateInfo.plist b/Xcode Templates/Integration Test.xctemplate/TemplateInfo.plist new file mode 100644 index 0000000..d8b97d7 --- /dev/null +++ b/Xcode Templates/Integration Test.xctemplate/TemplateInfo.plist @@ -0,0 +1,39 @@ + + + + + Kind + Xcode.IDEFoundation.TextSubstitutionFileTemplateKind + Description + Default new feature implementation + Summary + Creates minimum default files and implementation for a new feature + SortOrder + 30 + AllowedTypes + + public.swift-source + + DefaultCompletionName + File + MainTemplateFile + ___FILEBASENAME___.swift + Options + + + Identifier + productName + Required + + Name + Filebase: + Description + The name base of the objects to create + Type + text + Default + FileBase + + + + diff --git a/Xcode Templates/Integration Test.xctemplate/___FILEBASENAME___InteractorMock.swift b/Xcode Templates/Integration Test.xctemplate/___FILEBASENAME___InteractorMock.swift new file mode 100644 index 0000000..26f7e40 --- /dev/null +++ b/Xcode Templates/Integration Test.xctemplate/___FILEBASENAME___InteractorMock.swift @@ -0,0 +1,60 @@ +// +// ___FILENAME___ +// ___PROJECTNAME___ +// +// Created by ___FULLUSERNAME___ on ___DATE___. +//___COPYRIGHT___ +// + +import Foundation + +class ___FILEBASENAMEASIDENTIFIER___: ___VARIABLE_productName:identifier___InteractorInput +{ + // MARK: - Variables + + private var stateCase: StateCase + weak var output: ___VARIABLE_productName:identifier___InteractorOutput? + + // MARK: - init + + init(stateCase: StateCase) { + self.stateCase = stateCase + } + + // Here you can implement you interactor methods and set up output or other methods depending on your sate case : + // + // func getMethod() { + // switch stateCase { + // case .success : + // scenario_02_success() + // case default: + // scenario_01_error() + // } + // } + + // MARK: - SCENARIOS + + // Here you can implement you interactor mock methods to call for outputs you want to check for specific scenarios : + // + // private func scenario_01_error() { + // output?.showSuccess() + // } + // + // private func scenario_02_success() { + // output?.showError() + // } +} + +/// This code is here to manage state case for different scenarios +/// It should be moved to some other file +public enum StateCase +{ + case success + case error +} + +public class StateCaseManager +{ + public static let shared = StateCaseManager() + public var stateCase: StateCase = .success +} diff --git a/Xcode Templates/Integration Test.xctemplate/___FILEBASENAME___Tests.swift b/Xcode Templates/Integration Test.xctemplate/___FILEBASENAME___Tests.swift new file mode 100644 index 0000000..2c79ded --- /dev/null +++ b/Xcode Templates/Integration Test.xctemplate/___FILEBASENAME___Tests.swift @@ -0,0 +1,82 @@ +// +// ___FILENAME___ +// ___PROJECTNAME___ +// +// Created by ___FULLUSERNAME___ on ___DATE___. +//___COPYRIGHT___ +// + +// For our testing we made the choice to use [Quick](https://github.com/Quick/Quick) and [Nimble](https://github.com/Quick/Nimble). +// These tools allow us to work efficiently with the GIVEN / WHEN / THEN format. + + +import XCTest +import Quick +import Nimble + +final class ___FILEBASENAMEASIDENTIFIER___: QuickSpec, ExtendedTesting +{ + // First describe should give us a context about the functionalities to test + describe("As a user") + + /// A struct to give specific state and other static properties if needed to our scenarios + struct TestCase { + var stateCase: StateCase + } + + public var viewController: ___VARIABLE_productName:identifier___ViewController? + var storyboardName: String { return "Main" } + + /// instantiate all the necessary chain to run our tests + /// - parameter testCase: A struct containing the state for a specific scenario + private func setup(_ testCase: TestCase) { + self.setupViewController() + + let interactor = ___VARIABLE_productName:identifier___InteractorMock(stateCase: testCase.stateCase) + let presenter = ___VARIABLE_productName:identifier___Presenter(interactor: interactor) + interactor.output = presenter + presenter.view = self.viewController + self.viewController?.presenter = presenter + self.viewController?.presenter?.viewDidLoad() + } + + override func spec() { + // GIVEN should desribe our state, what we use as our `testCase` + describe("GIVEN") { + // WHEN should give us the interaction taking place. This would be what gives us informations about the actions to trigger + context("WHEN") { + beforeEach { + let testCase = TestCase(stateCase: .success) + self.setup(testCase) + } + // THEN gives us what to expect. + it("THEN") { + //expect(self.viewController?.titleLabel?.text).toEventually(equal("Hello world!")) + } + } + } +} + + +/// This extension is a helper to facilitate storyboard and view controllers manipulation. +/// It should be moved to a separate file + +public protocol ExtendedTesting: class { + + associatedtype T: UIViewController + + var viewController: T? { get set } + var storyboardName: String { get } + + func setupViewController() +} + +public extension ExtendedTesting { + public var storyboardName: String { return "Main" } + + public func setupViewController() { + viewController = UIViewController.fromStoryboard(named: storyboardName, withIdentifier: String(describing: T.self), ofClass: T.self) + viewController?.view.layoutSubviews() + } + +} diff --git a/Xcode Templates/New Feature.xctemplate/.DS_Store b/Xcode Templates/New Feature.xctemplate/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/Xcode Templates/New Feature.xctemplate/.DS_Store differ diff --git a/Xcode Templates/New Feature.xctemplate/TemplateIcon.png b/Xcode Templates/New Feature.xctemplate/TemplateIcon.png new file mode 100644 index 0000000..e885da0 Binary files /dev/null and b/Xcode Templates/New Feature.xctemplate/TemplateIcon.png differ diff --git a/Xcode Templates/New Feature.xctemplate/TemplateIcon@2x.png b/Xcode Templates/New Feature.xctemplate/TemplateIcon@2x.png new file mode 100644 index 0000000..8eda5e5 Binary files /dev/null and b/Xcode Templates/New Feature.xctemplate/TemplateIcon@2x.png differ diff --git a/Xcode Templates/New Feature.xctemplate/TemplateInfo.plist b/Xcode Templates/New Feature.xctemplate/TemplateInfo.plist new file mode 100644 index 0000000..d8b97d7 --- /dev/null +++ b/Xcode Templates/New Feature.xctemplate/TemplateInfo.plist @@ -0,0 +1,39 @@ + + + + + Kind + Xcode.IDEFoundation.TextSubstitutionFileTemplateKind + Description + Default new feature implementation + Summary + Creates minimum default files and implementation for a new feature + SortOrder + 30 + AllowedTypes + + public.swift-source + + DefaultCompletionName + File + MainTemplateFile + ___FILEBASENAME___.swift + Options + + + Identifier + productName + Required + + Name + Filebase: + Description + The name base of the objects to create + Type + text + Default + FileBase + + + + diff --git a/Xcode Templates/New Feature.xctemplate/___FILEBASENAME___.storyboard b/Xcode Templates/New Feature.xctemplate/___FILEBASENAME___.storyboard new file mode 100644 index 0000000..fc1aacb --- /dev/null +++ b/Xcode Templates/New Feature.xctemplate/___FILEBASENAME___.storyboard @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Xcode Templates/New Feature.xctemplate/___FILEBASENAME___ViewController.swift b/Xcode Templates/New Feature.xctemplate/___FILEBASENAME___ViewController.swift new file mode 100644 index 0000000..5a113bf --- /dev/null +++ b/Xcode Templates/New Feature.xctemplate/___FILEBASENAME___ViewController.swift @@ -0,0 +1,38 @@ +// +// ___FILENAME___ +// ___PROJECTNAME___ +// +// Created by ___FULLUSERNAME___ on ___DATE___. +//___COPYRIGHT___ +// + +import Foundation +import UIKit + +class ___FILEBASENAMEASIDENTIFIER___: UIViewController +{ + // MARK: - Property + + var presenter: ___VARIABLE_productName:identifier___ViewInterface? = nil + + // MARK: - Life cycle + + override func viewDidLoad() + { + super.viewDidLoad() + // Do any additional setup after loading the view. + } + + override func didReceiveMemoryWarning() + { + super.didReceiveMemoryWarning() + // Dispose of any resources that can be recreated. + } +} + +// MARK: - View Interface + +extension ___FILEBASENAMEASIDENTIFIER___: ___VARIABLE_productName:identifier___ViewInterface +{ + +} diff --git a/Xcode Templates/User Interface.xctemplate/.DS_Store b/Xcode Templates/User Interface.xctemplate/.DS_Store new file mode 100644 index 0000000..26b3990 Binary files /dev/null and b/Xcode Templates/User Interface.xctemplate/.DS_Store differ diff --git a/Xcode Templates/User Interface.xctemplate/TemplateIcon.png b/Xcode Templates/User Interface.xctemplate/TemplateIcon.png new file mode 100644 index 0000000..e885da0 Binary files /dev/null and b/Xcode Templates/User Interface.xctemplate/TemplateIcon.png differ diff --git a/Xcode Templates/User Interface.xctemplate/TemplateIcon@2x.png b/Xcode Templates/User Interface.xctemplate/TemplateIcon@2x.png new file mode 100644 index 0000000..8eda5e5 Binary files /dev/null and b/Xcode Templates/User Interface.xctemplate/TemplateIcon@2x.png differ diff --git a/Xcode Templates/User Interface.xctemplate/TemplateInfo.plist b/Xcode Templates/User Interface.xctemplate/TemplateInfo.plist new file mode 100644 index 0000000..5137c36 --- /dev/null +++ b/Xcode Templates/User Interface.xctemplate/TemplateInfo.plist @@ -0,0 +1,39 @@ + + + + + Kind + Xcode.IDEFoundation.TextSubstitutionFileTemplateKind + Description + Default user interface implementation + Summary + Creates minimum default files and implementation for a user interface + SortOrder + 30 + AllowedTypes + + public.swift-source + + DefaultCompletionName + File + MainTemplateFile + ___FILEBASENAME___.swift + Options + + + Identifier + productName + Required + + Name + Filebase: + Description + The name base of the objects to create + Type + text + Default + FileBase + + + + diff --git a/Xcode Templates/User Interface.xctemplate/___FILEBASENAME___Presenter.swift b/Xcode Templates/User Interface.xctemplate/___FILEBASENAME___Presenter.swift new file mode 100644 index 0000000..0f60d36 --- /dev/null +++ b/Xcode Templates/User Interface.xctemplate/___FILEBASENAME___Presenter.swift @@ -0,0 +1,39 @@ +// +// ___FILENAME___ +// ___PROJECTNAME___ +// +// Created by ___FULLUSERNAME___ on ___DATE___. +//___COPYRIGHT___ +// + +import Foundation + +class ___FILEBASENAMEASIDENTIFIER___ +{ + // MARK: - Property + + var interactor: ___VARIABLE_productName:identifier___InteractorInput? = nil + var view: ___VARIABLE_productName:identifier___ViewInterface? = nil + + // MARK: - Life cycle + + init(interactor: ___VARIABLE_productName:identifier___InteractorInput?) { + self.interactor = interactor + } +} + +// MARK: - Presenter Input + +extension ___FILEBASENAMEASIDENTIFIER___: ___VARIABLE_productName:identifier___PresenterInput +{ + func viewDidLoad() { + + } +} + +// MARK: - Interactor Output + +extension ___FILEBASENAMEASIDENTIFIER___: ___VARIABLE_productName:identifier___InteractorOutput +{ + +} diff --git a/Xcode Templates/User Interface.xctemplate/___FILEBASENAME___PresenterInput.swift b/Xcode Templates/User Interface.xctemplate/___FILEBASENAME___PresenterInput.swift new file mode 100644 index 0000000..bdd58f8 --- /dev/null +++ b/Xcode Templates/User Interface.xctemplate/___FILEBASENAME___PresenterInput.swift @@ -0,0 +1,15 @@ +// +// ___FILENAME___ +// ___PROJECTNAME___ +// +// Created by ___FULLUSERNAME___ on ___DATE___. +//___COPYRIGHT___ +// + +import Foundation + +protocol ___FILEBASENAMEASIDENTIFIER___ +{ + /// Notifies that the view did load + func viewDidLoad() +} diff --git a/Xcode Templates/User Interface.xctemplate/___FILEBASENAME___ViewInterface.swift b/Xcode Templates/User Interface.xctemplate/___FILEBASENAME___ViewInterface.swift new file mode 100644 index 0000000..552929e --- /dev/null +++ b/Xcode Templates/User Interface.xctemplate/___FILEBASENAME___ViewInterface.swift @@ -0,0 +1,14 @@ +// +// ___FILENAME___ +// ___PROJECTNAME___ +// +// Created by ___FULLUSERNAME___ on ___DATE___. +//___COPYRIGHT___ +// + +import Foundation + +protocol ___FILEBASENAMEASIDENTIFIER___ +{ + +}