Last active
November 19, 2018 18:04
-
-
Save vaderdan/cfd9ef853f123143e580ec2e3664a8c1 to your computer and use it in GitHub Desktop.
Revisions
-
vaderdan revised this gist
Nov 19, 2018 . 1 changed file with 12 additions and 14 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,23 +1,21 @@ protocol MenuViewCellModelInput { var detailsAction: Action<Observable<Menu>, Void> { get } } protocol MenuViewCellModelOutput { var title: Observable<String>! { get } var subtitle: Observable<String>! { get } var count: Observable<Int>! { get } } protocol MenuViewCellModelType { var inputs: MenuViewCellModelInput { get } var outputs: MenuViewCellModelOutput { get } } extension MenuViewCellModel: MenuViewCellModelType, MenuViewCellModelInput, MenuViewCellModelOutput { // MARK: Inputs & Outputs var inputs: MenuViewCellModelInput { return self } var outputs: MenuViewCellModelOutput { return self } } -
vaderdan revised this gist
Nov 19, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,6 +14,6 @@ class MenuViewCellModel: AutoModel { var count: Observable<Int>! /// sourcery:end var menu: Menu } -
vaderdan renamed this gist
Nov 19, 2018 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
vaderdan created this gist
Nov 19, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ class MenuViewCellModel: AutoModel { /// sourcery:begin: input var detailsAction: Action<Observable<Menu>, Void> = { return Action<Observable<Menu>, Void> { _ in return .empty() } }() /// sourcery:end /// sourcery:begin: output var title: Observable<String>! var subtitle: Observable<String>! var count: Observable<Int>! /// sourcery:end /// sourcery: variable var menu: Menu } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ protocol MenuViewModelInput { var loadMore: BehaviorSubject<Bool> { get } var query: BehaviorSubject<MenuQuery> { get } func refresh() } protocol MenuViewModelOutput { var emails: Observable<[Menu]>! { get } var isRefreshing: Observable<Bool> { get } var items: Observable<[MenuViewCellModelType]> { get } } protocol MenuViewModelType { var inputs: MenuViewModelInput { get } var outputs: MenuViewModelOutput { get } } extension MenuViewModel: MenuViewModelType, MenuViewModelInput, MenuViewModelOutput { // MARK: Inputs & Outputs var inputs: MenuViewModelInput { return self } var outputs: MenuViewModelOutput { return self } } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,42 @@ import RxSwift import Action import UIKit {% for type in types.implementing.AutoModel %} // MARK: {{ type.name }} protocol {{ type.name }}Input { {% for variable in type.variables %} {% if variable.annotations.input %} var {{ variable.name }}: {{ variable.typeName }} { get } {% endif %} {% endfor %} {% for method in type.methods %} {% if method.annotations.input %} func {{ method.name }} {% endif %} {% endfor %} } protocol {{ type.name }}Output { {% for variable in type.variables %} {% if variable.annotations.output %} var {{ variable.name }}: {{ variable.typeName }} { get } {% endif %} {% endfor %} } protocol {{ type.name }}Type { var inputs: {{ type.name }}Input { get } var outputs: {{ type.name }}Output { get } } extension {{ type.name }}: {{ type.name }}Type, {{ type.name }}Input, {{ type.name }}Output { // MARK: Inputs & Outputs var inputs: {{ type.name }}Input { return self } var outputs: {{ type.name }}Output { return self } } {% endfor %}