Swift 5: Protocol-Oriented Programming
1h 59mAdvanced2020-01-15
Authors

Károly Nyisztor
Mobile Developer, Instructor
Course details
Take a closer look at protocol-oriented programming (POP), a new paradigm introduced by Apple. In this course, instructor Károly Nyisztor explains what POP is, how it differs from classical approaches, and how to work with it to efficiently develop apps with Swift. Learn about the pillars of POP: protocol extensions, protocol inheritance, and protocol composition. Protocol extensions let you define default behavior for conforming types without defining a base class. Protocol inheritance is a powerful feature that lets you create more granular designs. Swift does not allow multiple inheritance for classes—but with protocol composition, Swift types can adopt multiple protocols. Plus, explore generics, and see how to implement a fully functional app using a protocol-oriented approach.
Learning objectives
Comparing OOP with POP
Adopting a protocol
Working with generic types
Using generics with protocols
Implementing an app using POP
Integrating a fallback service
Learning objectives
Comparing OOP with POP
Adopting a protocol
Working with generic types
Using generics with protocols
Implementing an app using POP
Integrating a fallback service
Skills covered
SwiftiOSAppleProgramming LanguagesSoftware DevelopmentDeep Dive (X:Y)
Concepts
0. Introduction
- 01 - Benefits - Protocol-oriented programming
- 02 - What you should know
1. The Pillars of Protocol Orientation
- 03 - What is protocol-oriented programming
- 04 - Introducing the protocol
- 05 - Adopting protocols
- 06 - Conforming to protocols via extensions
- 07 - Understanding polymorphism
- 08 - Protocol inheritance
- 09 - Adopting multiple protocols
- 10 - Protocol extensions
- 11 - Challenge - Removing tight coupling
- 12 - Solution - Removing tight coupling
2. Protocol-Oriented Programming
- 13 - Why protocols
- 14 - From unstructured code to POP
- 15 - Designing with classes - First try
- 16 - Designing with classes - Subclassing
- 17 - The benefits of thinking in protocols
- 18 - Highlighting the differences
3. Generics
- 19 - The importance of generics
- 20 - Defining generic functions and methods
- 21 - Working with generic types
- 22 - Placeholder types in protocols
- 23 - Using generics with protocols
- 24 - Challenge - Implementing a generic stack
- 25 - Solution - Implementing a generic stack
4. Implement the Weather App Using POP
- 26 - Weather app design
- 27 - Defining the UI using SwiftUI
- 28 - The WebServiceController protocol
- 29 - Working with a third-party API
- 30 - Implementing the OpenWeatherMap controller
- 31 - Completing the OpenWeatherMap controller
- 32 - Introducing the view model
- 33 - Presenting weather data
- 34 - Challenge - Integrating a fallback service
- 35 - Solution - Integrating a fallback service
Conclusion
- 36 - Next steps
Related courses
- Open RAN (ORAN) Architecture, Evolution, and Deployment
- Swift 5 Essential Training
- Programming for Non-Programmers: iOS 15 and Swift 5
- Programming for Non-Programmers: iOS 16 and Swift 5
- Programming for Non-programmers: iOS 17 and Swift 5
- PHP: Email with Swift Mailer
- Coaching and Developing Employees (2019)
- AI Literacy for Business Leaders