- Create empty
MainModuleBuilder.swift
file inside exmpl/Main
folder in exmpl
project
- Implement build function
import Foundation
import Highway
final class MainModuleBuilder {
func build() -> UIViewController {
let store = Store<MainFeature.State, MainFeature.Action>(
reducer: MainFeature.reducer(),
state: MainFeature.State()
)
let viewController = MainViewController(store: store)
return viewController
}
}
- Open
SceneDelegate.swift
, call build function and present MainViewController
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
// ...
window.makeKeyAndVisible()
let mainViewController = MainModuleBuilder().build()
otherViewController.present(mainViewController, animated: true)
}
- Run app and tap on "plus" button. Label will update from 0 to 1
Next: Middleware and asyncronious logic