Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated templates with some tweaks #1

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,20 @@

import UIKit

enum ___FILEBASENAMEASIDENTIFIER___Configurator {
static func configure(viewController: ___FILEBASENAMEASIDENTIFIER___ViewController) {
let router = ___FILEBASENAMEASIDENTIFIER___Router()
enum ___VARIABLE_sceneName___Configurator {
static func configure(viewController: ___VARIABLE_sceneName___ViewController) {
let router = ___VARIABLE_sceneName___Router()
router.viewController = viewController

let presenter = ___FILEBASENAMEASIDENTIFIER___Presenter()
let presenter = ___VARIABLE_sceneName___Presenter()
presenter.output = viewController

let interactor = ___FILEBASENAMEASIDENTIFIER___Interactor()
let interactor = ___VARIABLE_sceneName___Interactor()
interactor.output = presenter

// setup worker here
// interactor.loginWorker = ___VARIABLE_sceneName___WorkerProtocol

viewController.output = interactor
viewController.router = router
}
Expand Down
20 changes: 15 additions & 5 deletions Templates/Interactor.xctemplate/___FILEBASENAME___Interactor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,21 @@

import UIKit

protocol ___FILEBASENAMEASIDENTIFIER___Interactable {

protocol ___VARIABLE_sceneName___InteractorOutput {
func presentSomething(response: ___VARIABLE_sceneName___.Something.Response)
}

final class ___FILEBASENAMEASIDENTIFIER___Interactor: ___FILEBASENAMEASIDENTIFIER___Interactable {
var output: ___FILEBASENAMEASIDENTIFIER___Presentable!
var worker: ___FILEBASENAMEASIDENTIFIER___Worker!
final class ___VARIABLE_sceneName___Interactor: ___VARIABLE_sceneName___ViewControllerOutput {
var output: ___VARIABLE_sceneName___InteractorOutput!
var worker: ___VARIABLE_sceneName___WorkerProtocol!

// MARK: - Business logic
func doSomething(request: ___VARIABLE_sceneName___.Something.Request) {
// NOTE: Create some Worker to do the work
worker.doSomeWork()

// NOTE: Pass the result to the Presenter
let response = ___VARIABLE_sceneName___.Something.Response()
output.presentSomething(response: response)
}
}
11 changes: 9 additions & 2 deletions Templates/Models.xctemplate/___FILEBASENAME___Models.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@

import UIKit
Copy link

@ghost ghost Sep 11, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for starter, wouldnt this be better import Foundation?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pravda. stacilo. 👍


enum ___FILEBASENAMEASIDENTIFIER___ {

enum ___VARIABLE_sceneName___ {
enum Something {
struct Request {
}
struct Response {
}
struct ViewModel {
}
}
}
15 changes: 11 additions & 4 deletions Templates/Presenter.xctemplate/___FILEBASENAME___Presenter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,17 @@

import UIKit

protocol ___FILEBASENAMEASIDENTIFIER___Presentable {

protocol ___VARIABLE_sceneName___PresenterOutput: class {
func displaySomething(viewModel: ___VARIABLE_sceneName___.Something.ViewModel)
}

final class ___FILEBASENAMEASIDENTIFIER___Presenter: ___FILEBASENAMEASIDENTIFIER___Presentable {
weak var output: ___FILEBASENAMEASIDENTIFIER___Displayable!
final class ___VARIABLE_sceneName___Presenter: ___VARIABLE_sceneName___InteractorOutput {
weak var output: ___VARIABLE_sceneName___PresenterOutput?

func presentSomething(response: ___VARIABLE_sceneName___.Something.Response) {
// NOTE: Format the response from the Interactor and pass the result back to the View Controller

let viewModel = ___VARIABLE_sceneName___.Something.ViewModel()
output?.displaySomething(viewModel: viewModel)
}
}
8 changes: 4 additions & 4 deletions Templates/Router.xctemplate/___FILEBASENAME___Router.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

import UIKit

protocol ___FILEBASENAMEASIDENTIFIER___RouterInput {
final class ___VARIABLE_sceneName___Router: ___VARIABLE_sceneName___ViewControllerRouter {
weak var viewController: ___VARIABLE_sceneName___ViewController!

}
func navigateToSomewhere() {

final class ___FILEBASENAMEASIDENTIFIER___Router: ___FILEBASENAMEASIDENTIFIER___RouterInput {
weak var viewController: ___FILEBASENAMEASIDENTIFIER___ViewController!
}
}
66 changes: 33 additions & 33 deletions Templates/Scene.xctemplate/TemplateInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
<dict>
<key>DefaultCompletionName</key>
<string>MyScene</string>
<key>Description</key>
<string>This generates a new scene using Uncle Bob's clean architecture. It consists of the view controller, interactor, presenter, and router. You can then create individual workers to supplement the interactor.</string>
<key>Kind</key>
<string>Xcode.IDEKit.TextSubstitutionFileTemplateKind</string>
<key>Options</key>
<array>
<key>Description</key>
<string>This generates a new scene using Uncle Bob&apos;s clean architecture. It consists of the view controller, interactor, presenter, and router. You can then create individual workers to supplement the interactor.</string>
<key>Kind</key>
<string>Xcode.IDEKit.TextSubstitutionFileTemplateKind</string>
<key>Options</key>
<array>
<dict>
<key>Description</key>
<string>The name of the scene to create</string>
Expand All @@ -24,15 +24,15 @@
<key>Type</key>
<string>text</string>
</dict>
<dict>
<dict>
<key>Default</key>
<string>___VARIABLE_sceneName:identifier___</string>
<key>Identifier</key>
<string>productName</string>
<key>Type</key>
<string>static</string>
</dict>
<dict>
</dict>
<dict>
<key>Default</key>
<string>___VARIABLE_sceneName:identifier___ViewController</string>
<key>Description</key>
Expand All @@ -45,8 +45,8 @@
<true/>
<key>Type</key>
<string>static</string>
</dict>
<dict>
</dict>
<dict>
<key>Default</key>
<string>___VARIABLE_sceneName:identifier___Interactor</string>
<key>Description</key>
Expand All @@ -59,8 +59,8 @@
<true/>
<key>Type</key>
<string>static</string>
</dict>
<dict>
</dict>
<dict>
<key>Default</key>
<string>___VARIABLE_sceneName:identifier___Presenter</string>
<key>Description</key>
Expand All @@ -73,8 +73,8 @@
<true/>
<key>Type</key>
<string>static</string>
</dict>
<dict>
</dict>
<dict>
<key>Default</key>
<string>___VARIABLE_sceneName:identifier___Router</string>
<key>Description</key>
Expand All @@ -87,8 +87,8 @@
<true/>
<key>Type</key>
<string>static</string>
</dict>
<dict>
</dict>
<dict>
<key>Default</key>
<string>___VARIABLE_sceneName:identifier___Configurator</string>
<key>Description</key>
Expand All @@ -101,22 +101,22 @@
<true/>
<key>Type</key>
<string>static</string>
</dict>
<dict>
</dict>
<dict>
<key>Default</key>
<string>___VARIABLE_sceneName:identifier___Worker</string>
<string>___VARIABLE_sceneName:identifier___WorkerProtocols</string>
<key>Description</key>
<string>The worker name</string>
<string>The worker protocols name</string>
<key>Identifier</key>
<string>workerName</string>
<string>workerProtocolsName</string>
<key>Name</key>
<string>Worker Name:</string>
<string>Worker Protocols Name:</string>
<key>Required</key>
<true/>
<key>Type</key>
<string>static</string>
</dict>
<dict>
</dict>
<dict>
<key>Default</key>
<string>___VARIABLE_sceneName:identifier___Models</string>
<key>Description</key>
Expand All @@ -129,7 +129,7 @@
<true/>
<key>Type</key>
<string>static</string>
</dict>
</dict>
<dict>
<key>Default</key>
<string>UIViewController</string>
Expand All @@ -154,14 +154,14 @@
<string>UICollectionViewController</string>
</array>
</dict>
</array>
<key>Platforms</key>
<array>
</array>
<key>Platforms</key>
<array>
<string>com.apple.platform.iphoneos</string>
</array>
</array>
<key>SortOrder</key>
<string>9</string>
<key>Summary</key>
<string>This generates a new scene using Uncle Bob's clean architecture.</string>
<key>Summary</key>
<string>This generates a new scene using Uncle Bob&apos;s clean architecture.</string>
</dict>
</plist>
</plist>
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,20 @@

import UIKit

enum ___FILEBASENAMEASIDENTIFIER___Configurator {
static func configure(viewController: ___FILEBASENAMEASIDENTIFIER___ViewController) {
let router = ___FILEBASENAMEASIDENTIFIER___Router()
enum ___VARIABLE_sceneName___Configurator {
static func configure(viewController: ___VARIABLE_sceneName___ViewController) {
let router = ___VARIABLE_sceneName___Router()
router.viewController = viewController

let presenter = ___FILEBASENAMEASIDENTIFIER___Presenter()
let presenter = ___VARIABLE_sceneName___Presenter()
presenter.output = viewController

let interactor = ___FILEBASENAMEASIDENTIFIER___Interactor()
let interactor = ___VARIABLE_sceneName___Interactor()
interactor.output = presenter

// setup worker here
// interactor.loginWorker = ___VARIABLE_sceneName___WorkerProtocol

viewController.output = interactor
viewController.router = router
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,21 @@

import UIKit

protocol ___FILEBASENAMEASIDENTIFIER___Interactable {

protocol ___VARIABLE_sceneName___InteractorOutput {
func presentSomething(response: ___VARIABLE_sceneName___.Something.Response)
}

final class ___FILEBASENAMEASIDENTIFIER___Interactor: ___FILEBASENAMEASIDENTIFIER___Interactable {
var output: ___FILEBASENAMEASIDENTIFIER___Presentable!
var worker: ___FILEBASENAMEASIDENTIFIER___Worker!
final class ___VARIABLE_sceneName___Interactor: ___VARIABLE_sceneName___ViewControllerOutput {
var output: ___VARIABLE_sceneName___InteractorOutput!
var worker: ___VARIABLE_sceneName___WorkerProtocol!

// MARK: - Business logic
func doSomething(request: ___VARIABLE_sceneName___.Something.Request) {
// NOTE: Create some Worker to do the work
worker.doSomeWork()

// NOTE: Pass the result to the Presenter
let response = ___VARIABLE_sceneName___.Something.Response()
output.presentSomething(response: response)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@

import UIKit

enum ___FILEBASENAMEASIDENTIFIER___ {

enum ___VARIABLE_sceneName___ {
enum Something {
struct Request {
}
struct Response {
}
struct ViewModel {
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,17 @@

import UIKit

protocol ___FILEBASENAMEASIDENTIFIER___Presentable {

protocol ___VARIABLE_sceneName___PresenterOutput: class {
func displaySomething(viewModel: ___VARIABLE_sceneName___.Something.ViewModel)
}

final class ___FILEBASENAMEASIDENTIFIER___Presenter: ___FILEBASENAMEASIDENTIFIER___Presentable {
weak var output: ___FILEBASENAMEASIDENTIFIER___Displayable!
final class ___VARIABLE_sceneName___Presenter: ___VARIABLE_sceneName___InteractorOutput {
weak var output: ___VARIABLE_sceneName___PresenterOutput?

func presentSomething(response: ___VARIABLE_sceneName___.Something.Response) {
// NOTE: Format the response from the Interactor and pass the result back to the View Controller

let viewModel = ___VARIABLE_sceneName___.Something.ViewModel()
output?.displaySomething(viewModel: viewModel)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

import UIKit

protocol ___FILEBASENAMEASIDENTIFIER___RouterInput {
final class ___VARIABLE_sceneName___Router: ___VARIABLE_sceneName___ViewControllerRouter {
weak var viewController: ___VARIABLE_sceneName___ViewController!

}
func navigateToSomewhere() {

final class ___FILEBASENAMEASIDENTIFIER___Router: ___FILEBASENAMEASIDENTIFIER___RouterInput {
weak var viewController: ___FILEBASENAMEASIDENTIFIER___ViewController!
}
}
Loading