Protocols are a fundamental concept in Swift; they empower you to write code that’s flexible, adaptable and easily reusable. Furthermore, they enable you to model behavior that isn’t connected to inheritance. In Swift, a class can inherit from just one parent class, and structs don’t have inheritance at all. However, both structs and classes can adopt multiple protocols, allowing you to create your types to suit specific needs.

In this lesson, you’ll dive into the world of Swift protocols, exploring their definition, their real-world applications and how they enable you to create code that conforms to specific contracts. By the end, you’ll have a solid introduction to protocols and how to leverage them to enhance your iOS development skills.

See forum comments
Download course materials from Github
Previous: Quiz: Inheritance & Polymorphism Next: Instruction