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
struct Dog : Animal { | |
var animalType: String { | |
return "dog" | |
} | |
} | |
protocol Animal { | |
var animalType: String { get } |
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
struct ColorItemViewModel: ItemViewModel { | |
var reuseIdentifier: String | |
var color: UIColor | |
} | |
extension ColorItemViewModel: BuilderContainer { | |
func getBuilder<Context>(_ contextType: Context.Type) -> Builder<Context>? { |
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
public protocol BuilderContainer { | |
func getBuilder<Context>(_ contextType: Context.Type) -> Builder<Context>? | |
} |
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
public typealias InteractionFactory = InteractionDelegate & AbstractFactory | |
public extension InteractionDelegate where Self: AbstractFactory { | |
func containerView(_ containerView: UIView, shouldSelect item: ItemViewModel) -> Bool { | |
return item is BuilderContainer | |
} | |
func containerView(_ containerView: UIView, didSelect item: ItemViewModel) { | |
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
public protocol AbstractFactory { | |
associatedtype Context | |
var context: Context { get } | |
var presenterViewController: UIViewController? { get } | |
func make(from builder: Builder<Context>) -> UIViewController? | |
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
open class ExampleBuilder<Context>: Builder<Context> { | |
var title: String | |
public init(title: String) { | |
self.title = title | |
super.init() | |
} | |
open override func build(_ context: Context) -> UIViewController? { |
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
public protocol InteractionDelegate: class { | |
func containerView(_ containerView: UIView, shouldSelect item: ItemViewModel) -> Bool | |
func containerView(_ containerView: UIView, didSelect item: ItemViewModel) | |
func containerView(_ containerView: UIView, shouldDeselect item: ItemViewModel) -> Bool | |
func containerView(_ containerView: UIView, didDeselect item: ItemViewModel) | |
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
open class Builder<Context> { | |
public init() { } | |
open func build(_ context: Context) -> UIViewController? { | |
return nil | |
} | |
} |
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
struct BaseSection: SectionViewModel { | |
var header: ItemViewModel? | |
var items: [ItemViewModel] | |
var footer: ItemViewModel? | |
init(header: ItemViewModel? = nil, items: [ItemViewModel] = [], footer: ItemViewModel? = nil) { | |
self.header = header |
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
class ColorCollectionViewCell: UICollectionViewCell { | |
struct Descriptor: ItemViewDescriptor, GridDescriptor { | |
let reuseIdentifier: String = String(describing: ColorCollectionViewCell.self) | |
let ratio: ViewRatio = ViewRatio(multiplier: 1.6, constant: 0.0) | |
} | |
} |
NewerOlder