Requires a pro subscription Pro

Advanced Swift: Protocol Oriented Programming

2 versions

Swift protocol oriented programming gives you the power of object oriented programming with better composability and without the baggage of class inheritance. By Ray Fix.

4.8 (12) · 2 Reviews

Save for later
Share

Learning path

This is part of the Advanced Swift learning path. View path.

Who is this for?

This course is for developers interested in getting a deeper understanding of the Swift language. It expects you to be comfortable with the basic syntax of Swift and to have perhaps written an app or two. You should be familiar with basic types in the Swift standard library.

Covered concepts

This course focuses on:

  • Protocol oriented programming
  • Class dispatch
  • Protocol dispatch
  • Retroactive modeling

1
Toggle description

Let's review what you'll be learning in this course on protocol oriented programming in Swift, and why it's important.

Toggle description

Let's learn about how Swift gives you the ability to build polymorphic class types with different levels of dynamism.

Toggle description

Swift protocols can be used to provide customization points with default implementations in extensions.

Toggle description

Convert object oriented code to protocol oriented code and observe the key differences between the two.

Toggle description

In this video you'll see how protocols and retroactive modeling can be used as a tool for unifying types.

Toggle description

In this challenge, try using retroactive modeling to compute the bounding boxes for different shapes.

Conclusion 1:49
Toggle description

Protocol oriented thinking is nothing new but Swift provides a unique way to achieve reuse without requiring a specific data layout.