NEW: Start my new Ultimate Portfolio App course with a free Hacking with Swift+ trial! >>

DAY 11

Protocols and extensions


Today you’re going to learn some truly Swifty functionality: protocols and protocol-oriented programming (POP).

POP does away with large, complex inheritance hierarchies, and replaces them with much smaller, simpler protocols that can be combined together. This really is the fulfillment of something Tony Hoare said many years ago: “inside every large program, there is a small program trying to get out.”

You’ll be using protocols from your very first SwiftUI project, and they’ll continue to be invaluable for your entire Swift coding career – it’s worth taking the time to get familiar with them.

Today you have six one-minute videos to watch, and you’ll meet protocols, extensions, and the combination of those two: protocol extensions. Once you’ve watched each video and any optional extra reading you wanted, there’s a short test to help make sure you’ve understood what was taught.

  1. Protocols
  2. Protocol inheritance
  3. Extensions
  4. Protocol extensions
  5. Protocol-oriented programming
  6. Protocols and extensions summary

That’s day 11 complete, so hopefully by now you know what to do: go and post about your progress online on Twitter, Facebook, Reddit, or whatever social media you like. You’re powered by POP now!

Have some questions about protocols?

Hit Send below to start a virtual conversation with me.

Need help? Tweet me @twostraws!

 

Hacking with Swift is sponsored by RevenueCat

SPONSORED Building and maintaining in-app subscription infrastructure is hard. Luckily there's a better way. With RevenueCat, you can implement subscriptions for your app in hours, not months, so you can get back to building your app.

Try it for free

Sponsor Hacking with Swift and reach the world's largest Swift community!

100 Days of SwiftUI


The 100 Days of SwiftUI is a free collection of videos, tutorials, tests, and more to help you learn SwiftUI faster. Click here to learn more, or watch the video below.

Back to 100 Days of SwiftUI

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.