In this lesson, you’ve scratched the surface of powerful Swift protocols, which enable you to model behavior that isn’t connected to inheritance. Protocols offer a flexible way to define blueprints for methods, properties and requirements, allowing your code to adapt and be more reusable.
Unlike traditional inheritance, both classes and structs can adopt multiple protocols as necessary. Swift has several standard library protocols such as Equatable and CustomStringConvertible, which you used in this lesson. Additionally, you can define your own to create reusable code that defines interfaces or functionality.
By embracing protocols, you unlock the potential for adaptable Swift code.
See forum comments
This content was released on Oct 17 2023. The official support period is 6-months
from this date.
Conclusion for protocols and interfaces.
Download course materials from Github
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress,
bookmark, personalise your learner profile and more!
Previous: Demo
Next: Quiz: Introduction to Protocols
All videos. All books.
One low price.
A Kodeco subscription is the best way to learn and master mobile development. Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.