This file contains 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 characters
import Foundation | |
protocol InitConfigurable { | |
init() | |
} | |
extension InitConfigurable { | |
init(configure: (Self) -> Void) { |
This file contains 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 characters
import Foundation | |
protocol IdentifiableType: Equatable, CustomStringConvertible { | |
var identity: String { get } | |
} | |
// MARK: - Equatable |
This file contains 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 characters
import UIKit | |
public extension UIView { | |
public func changeMargings(insets: UIEdgeInsets) { | |
if #available(iOS 11, *) { | |
directionalLayoutMargins = NSDirectionalEdgeInsets(top: insets.top, leading: insets.left, bottom: insets.bottom, trailing: insets.right) | |
} else { | |
layoutMargins = insets | |
} | |
} |
This file contains 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 characters
import UIKit | |
public extension UIViewController { | |
public var safeTopAnchor: NSLayoutYAxisAnchor { | |
if #available(iOS 11, *) { | |
return view.safeAreaLayoutGuide.topAnchor | |
} else { | |
return topLayoutGuide.bottomAnchor | |
} | |
} |
This file contains 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 characters
// App/AppDelegate.swift | |
import Unicore | |
typealias AppCore = Core<AppFeature.State> | |
let core = AppCore(state: .initial, reducer: AppFeature.reduce) | |
@UIApplicationMain | |
class AppDelegate: UIResponder, UIApplicationDelegate { |
This file contains 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 characters
// Features/App/AppReducer.swift | |
extension AppFeature { | |
static func reduce(_ old: State, with action: Action) -> State { | |
return State( | |
accountsState: AccountsFeature.reduce(old.accountsState, with: action), | |
categoriesState: CategoriesFeature.reduce(old.categoriesState, with: action), | |
keyboardState: KeyboardFeature.reduce(old.keyboardState, with: action), | |
transactionState: TransactionFeature.reduce(old.transactionState, with: action) | |
) |
This file contains 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 characters
// Features/App/AppState.swift | |
extension AppFeature { | |
struct State: Codable { | |
let accountsState: AccountsFeature.State | |
let categoriesState: CategoriesFeature.State | |
let keyboardState: KeyboardFeature.State | |
let transactionState: TransactionFeature.State |
This file contains 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 characters
// Components/Categories/CategoriesScene.swift | |
struct CategoriesScene { | |
static func makeScene(with repositories: RepositoryProviderProtocol) -> Scene<CategoriesConnector, CategoriesComponent> { | |
let connector = CategoriesConnector(repositories: repositories) | |
let component = CategoriesComponent(connector: connector) | |
return Scene(connector, component) | |
} | |
} |
This file contains 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 characters
// Components/Categories/CategoriesComponent.swift | |
final class CategoriesComponent: UIViewController, Component { | |
// Props | |
private let connector: CategoriesConnector! | |
var props: CategoriesProps! { | |
didSet { | |
guard props != oldValue else { |
This file contains 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 characters
// Components/Categories/CategoriesConnector.swift | |
final class CategoriesConnector: Connector { | |
private let disposer = Disposer() | |
let repositories: RepositoryProviderProtocol | |
required init(repositories: RepositoryProviderProtocol) { |
NewerOlder