December 2018
Intermediate to advanced
414 pages
10h 19m
English
Empty protocols can be useful as we've seen previously, but protocols are meant to provide requirements.
Protocols can require different aspects of objects:
protocol DemoProtocol { var aRequiredProperty: String { get set } var aReadonlyProperty: Double { get } static var aStaticProperty: Int { get set } init(requiredProperty: String) func doSomething() -> Bool }
The previous DemoProtocol protocol exposes all of the requirements a conforming class should provide:
Read now
Unlock full access