Skip to content

Commit

Permalink
feature: Updated templetes to work with GoodReactor
Browse files Browse the repository at this point in the history
  • Loading branch information
andrej.jasso@goodrequest.com committed Apr 9, 2021
1 parent 2885308 commit 37fd7a0
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
</array>
<key>Options</key>
<array>

<dict>
<key>Identifier</key>
<string>ID</string>
Expand All @@ -31,8 +30,26 @@
<string>Base</string>
</array>
</dict>

<dict/>
<dict>
<key>Identifier</key>
<string>VarID</string>
<key>Required</key>
<true/>
<key>Name</key>
<string>Controller variable name</string>
<key>Description</key>
<string>The name of the controller variable(should be lowercased)</string>
<key>Type</key>
<string>text</string>
<key>Default</key>
<string>myAny+(ViewController)</string>
<key>NotPersisted</key>
<true/>
<key>Nodes</key>
<array>
<string>Base</string>
</array>
</dict>
</array>
</dict>
</plist>
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ final class ___VARIABLE_ID___Coordinator: Coordinator<AppStep> {

typealias DI = DependencyContainer

// MARK: - Constant
// MARK: - Constants

private let di: DI
private let parentCoordinator: Coordinator<AppStep>
Expand All @@ -43,14 +43,14 @@ final class ___VARIABLE_ID___Coordinator: Coordinator<AppStep> {
override func start() -> UIViewController? {
super.start()

let ___VARIABLE_ID___Controller = ___VARIABLE_ID___ViewController.create(
let ___VARIABLE_VarID___Controller = ___VARIABLE_ID___ViewController.create(
viewModel: ___VARIABLE_ID___ViewModel(
di: di,
coordinator: self
)
)

return ___VARIABLE_ID___Controller
return ___VARIABLE_VarID___Controller
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@ import Combine

final class ___VARIABLE_ID___ViewController: UIViewController {

// MARK: - Outlet
// MARK: - Outlets

// MARK: - Constant
// MARK: - Constants

private enum C {

}

// MARK: - Variable
// MARK: - Variables

private var viewModel: ___VARIABLE_ID___ViewModel!
private var cancellables = Set<AnyCancellable>()

// MARK: - Initializer

static func create(viewModel: ___VARIABLE_ID___ViewModel) -> Self {
let instance = makeInstance()
let instance = gr.makeInstance()
instance.viewModel = viewModel
return instance
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,81 +2,85 @@

import Foundation
import Combine
import GoodReactor
import GoodStructs
import GoodCombineExtensions

// MARK: - View Model Implementation

final class ___VARIABLE_ID___ViewModel: Reactor {
final class ___VARIABLE_ID___ViewModel: GoodReactor {

// MARK: - View Model Definition

typealias DI = WithRequestManager

struct State {

}

enum Action {

}

enum Mutation {

}
// MARK: - Constant
internal let initialState = State()
internal let coordinator: Coordinator<AppStep>

// MARK: - Constants

internal let initialState: State
internal let coordinator: GoodCoordinator<AppStep>

private let di: DI

// MARK: - Constructor

init(di: DI, coordinator: Coordinator<AppStep>) {
self.di = di
self.coordinator = coordinator
self.state = State()
}

}

// MARK: - Coordinator

extension ___VARIABLE_ID___ViewModel {

func navigate(action: Action) -> AppStep? {

}

}

// MARK: - Reactive

extension ___VARIABLE_ID___ViewModel {

func transform(action: AnyPublisher<Action, Never>) -> AnyPublisher<Action, Never> {
return Empty().erased
return Empty().eraseToAnyPublisher()
}

func mutate(action: Action) -> AnyPublisher<Mutation, Never> {
switch action {
default: break
}
}

func reduce(state: State, mutation: Mutation) -> State {
var state = state

switch mutation {
default: break
}

return state
}

}

// MARK: - Private

extension ___VARIABLE_ID___ViewModel {

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@ import Combine

final class ___VARIABLE_ID___ViewController: UIViewController {

// MARK: - Outlet
// MARK: - Outlets

// MARK: - Constant
// MARK: - Constants

private enum C {

}

// MARK: - Variable
// MARK: - Variables

private var viewModel: ___VARIABLE_ID___ViewModel!
private var cancellables = Set<AnyCancellable>()

// MARK: - Initializer

static func create(viewModel: ___VARIABLE_ID___ViewModel) -> Self {
let instance = makeInstance()
let instance = gr.makeInstance()
instance.viewModel = viewModel
return instance
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@

import Foundation
import Combine
import GoodReactor
import GoodStructs
import GoodCombineExtensions

// MARK: - View Model Implementation

final class ___VARIABLE_ID___ViewModel: Reactor {
final class ___VARIABLE_ID___ViewModel: GoodReactor {

// MARK: - View Model Definition

Expand All @@ -23,10 +26,10 @@ final class ___VARIABLE_ID___ViewModel: Reactor {

}

// MARK: - Constant
// MARK: - Constants

internal let initialState = State()
internal let coordinator: Coordinator<AppStep>
internal let initialState: State
internal let coordinator: GoodCoordinator<AppStep>

private let di: DI

Expand All @@ -35,6 +38,7 @@ final class ___VARIABLE_ID___ViewModel: Reactor {
init(di: DI, coordinator: Coordinator<AppStep>) {
self.di = di
self.coordinator = coordinator
self.state = State()
}

}
Expand All @@ -54,7 +58,7 @@ extension ___VARIABLE_ID___ViewModel {
extension ___VARIABLE_ID___ViewModel {

func transform(action: AnyPublisher<Action, Never>) -> AnyPublisher<Action, Never> {
return Empty().erased
return Empty().eraseToAnyPublisher()
}

func mutate(action: Action) -> AnyPublisher<Mutation, Never> {
Expand Down

0 comments on commit 37fd7a0

Please sign in to comment.