Swift Object ModelLesson 29Free preview
Swift Protocols
This lesson is part of Swift · All levels
Summary
This lesson reviews the Protocols which are the blueprint of the contract methods, properties, and other requirements in Swift. Protocols can be adopted by class, struct, or enum. Protocol-Oriented Programming is Swift's core philosophy that allows highly flexible feature composition without the weakness of dual inheritance.
Key points
- Protocol defines the interface contract that must be fulfilled by the type that adopts it
- Defined by the keyword 'protocol'
- Can be adopted by Struct, Class, and Enum at once
- Support for default implementation through Protocol Extensions
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.