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 characters
| extension StaticActionBinding where ActionType.PresenterType == NoPresenter { | |
| public func perform(with input: ActionType.InputType, | |
| completion: ((ActionOutcome) -> ())? = nil) { | |
| … | |
| } | |
| } | |
| extension StaticActionBinding where ActionType.InputType == NoInput { | |
| public func perform(using presenter: ActionType.PresenterType, | |
| completion: ((ActionOutcome) -> ())? = nil) { |
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 characters
| noInputAction.perform(using: somePresenter, with: .none) | |
| noPresenterAction.perform(using: NoPresenter(), with: someInput) | |
| noPresenterNoInputAction.perform(using: NoPresenter(), with: .none) |
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 characters
| final class BeepAction: Action { | |
| typealias InputType = NoInput | |
| typealias PresenterType = NoPresenter | |
| static func perform(with context: ActionContext<InputType>, using presenter: PresenterType, completion: ((ActionPerformOutcome) -> ())) { | |
| // … not important for this example | |
| } | |
| } |
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 characters
| public struct StaticActionBinding<FeatureType, ActionType>: CustomDebugStringConvertible | |
| where FeatureType: FeatureDefinition, ActionType: Action { | |
| … | |
| public func perform(using presenter: ActionType.PresenterType, | |
| with input: ActionType.InputType, | |
| completion: ((ActionOutcome) -> ())? = nil) { | |
| … | |
| } |
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 characters
| final class ShowMessageAction: Action { | |
| typealias InputType = String | |
| typealias PresenterType = MessagePresenter | |
| static func perform(with context: ActionContext<InputType>, using presenter: PresenterType, completion: ((ActionPerformOutcome) -> ())) { | |
| // … not important for this example | |
| } | |
| } |
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 characters
| //: Playground - noun: a place where people can play | |
| import UIKit | |
| protocol Action { | |
| associatedtype Input | |
| associatedtype Presenter | |
| static func present(i: Input, p: Presenter) | |
| } |
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 characters
| public class AppUISpec: UISpec { | |
| /// Define the grid point size | |
| public static let pointsPerGridUnit: CGFloat = 50.0 | |
| /// Convenient type aliases so that UISpecs inheriting from | |
| /// this can use shorter forms. | |
| public typealias Dimension = GridDimension<AppUISpec> | |
| public typealias Radius = RadiusDimension<AppUISpec> | |
| /// Standard unit multiples we use throughout |
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 characters
| public class OnboardingUISpec: AppUISpec { | |
| public enum Card { | |
| public static let cornerRadius = 📏.smallRadius | |
| public static let backgroundColor = 🖍.cardBackground | |
| public static let padding = 📏.standardCardPadding | |
| public static let headingFont = 🔤.massiveMarketingHeading | |
| public static let bodyFont = 🔤.body | |
| } |
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 characters
| public typealias 🖍 = Colors | |
| public typealias 📏 = Dimensions | |
| public typealias 🔤 = Fonts |