Your next career begins with
Save 50% off your seat in our next iOS Bootcamp. Limited time only. Sessions start April 3.
Advanced Swift: Generics and Protocols
The generics system and protocols are the heart of the Swift language. Learn how it all fits together in this course. By Ray Fix.
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress, bookmark, personalise your learner profile and more!
Create accountAlready a member of Kodeco? Sign in
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress, bookmark, personalise your learner profile and more!
Create accountAlready a member of Kodeco? Sign in
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:
- Parametric Polymorphism
- Protocols
- Generics
- Constraints
- Conformance
- Associated types
Generics are a key feature in Swift, which, combined with protocols, let you build clean, reusable abstractions. Let's get started!
What happens when you abstract across a type? Let's take a look at a simple generic type to find out.
Let's see how you can use protocol constraints to inform the type system about the capabilities of a type.
You know how to make structs, enum and classes generic. Learn how to make protocols generic using associated types.
It's time for a challenge! Try to use your new knowledge of associated types to build a generic protocol.
In this video, learn how you can add constraints to associated types. Now even specify them recursively.
Find out how you can add additional API to a type depending on the capability of an associated type.
In this challenge, let's put your knowledge of conditional conformance into action by adding API to a type.
Swift has one of the most powerful generic systems available that balances performance with ease of use.
All videos. All books.
One low price.
A Kodeco subscription is the best way to learn and master mobile development — plans start at just $19.99/month! Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.
Learn more