Introduction

Protocols in Swift are similar to interfaces in Kotlin and some other languages. Although both protocols and interfaces relate to the concept of inheritance, they differ in key ways. Protocols offer a powerful way to structure your apps, abstract away from external dependencies and simplify both testing and code organization.

In this module, you’ll learn the fundamentals of protocols and how to use them in your apps. You’ll see how to define them, how to implement them and how they provide a similar role to inheritance at a very high level. You’ll also learn about the differences that separate the two concepts.

Along the way, you’ll learn how to use some of the features of protocols in Swift, like composition, to build complex types that aren’t possible with inheritance. Finally, you’ll have the opportunity to use protocols in a SwiftUI app.

Protocol-Oriented Programming, or POP, takes the protocol concept and applies it to a design pattern for your software. POP makes it easy to integrate third-party dependencies, write testable code and build apps that are easy to maintain.

See forum comments
Download course materials from Github
Next: Instruction