Kickstarter ios-oss https://github.com/kickstarter/ios-oss POINT•FREE https://www.pointfree.co/ objc.io iOS at Kickstarter https://talk.objc.io/collections/ios-at-kickstarter How to Control the World https://vimeo.com/291588126 Reactive view models, simplified https://www.youtube.com/watch?v=uTLG_LgjWGA Kickstarter ios-ossߏͷղઆ https://note.mu/yimajo/n/ne44c7945279a RxSwiftݚڀಡຊ3 ViewModelઃܭύλʔϯೖ https://booth.pm/ja/items/1223536 Kickstarter-iOSͷViewModelͷ࡞Γํ͕Ϛ͔ͬͨ https://qiita.com/muukii0803/items/045b12405f7acff1a9fd
if you want to write a generalized sort or binary search…Don’t start with a class. Start with a protocol. Protocol-Oriented Programming in Swift WWDC2015
use value types, then if you need polymorphism, make them conform to protocols. Avoid classes. https://twitter.com/cocoaphony/status/1104114233288151043 ϙϦϞʔϑΟζϜ ಉ໊͡લͷϝιουΛෳͷΫϥεͰ༻Ͱ͖ΔΑ͏ʹ͠ɺͦͷϝ ιουΛ௨ͯ͠ɺ҉తʹෳͷΠϯελϯεͷಈ࡞ΛΓସ͑Δ ͜ͱ͕Ͱ͖ΔΑ͏ʹ͢Δ͜ͱ
…we considered a varied number of concrete types first. …we’re thinking about a kind of protocol that could join them all together. …it’s important to think of things as this way around. To start with some concrete types, and then try and unify them with a protocol. Swift Generics (Expanded) WWDC2018
Don’t Literally Start With a Protocol Start with a concrete use cases Discover a need for generic code Try to compose solutions from existing protocols first Consider a generic type instead of a protocol Modern Swift API Design WWDC2019
struct Item: Codable { let id: Int let name: String } struct User: Codable { let id: Int let name: String } struct Client { let baseURL = URL(string: “…”)! }
protocol Request { associatedtype Response: Fetchable var baseURL: URL { get } var path: String { get } var httpMethod: HTTPMethod { get } var parameters: [String: Any] { get } }
protocol Request { associatedtype Response: Fetchable var baseURL: URL { get } var path: String { get } var httpMethod: HTTPMethod { get } var parameters: [String: Any] { get } }
struct Item: Codable { struct ID: Identifiable { let value: String } let id: ID } struct User: Codable { struct ID: Identifiable { let value: Int } let id: ID }
protocol Fetchable: Decodable { associatedtype IDType: Codable typealias ID = Identifier var id: ID { get } static var apiBase: String { get } } ࣝผࢠ(Identifier)Λ࣋ͭ + API͔Βσʔλऔಘ
Don’t Literally Start With a Protocol Modern Swift API Design WWDC2019 Start with a concrete use cases Discover a need for generic code Try to compose solutions from existing protocols first Consider a generic type instead of a protocol
Kickstarter ios-oss Star with a protocol A mockery of protocols That’s not a number From Problem to Solution Protocol-Oriented Programming in Swift Swift Generics (Expanded) ࢀߟϦϯΫू