Swift 5: Protocol-Oriented Programming
Overview
Take a deep dive into protocol-oriented programming (POP), a new paradigm introduced by Apple. Learn how to work with POP to design and implement modern software with Swift.
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.
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.
Syllabus
Introduction
- Benefits: Protocol-oriented programming
- What you should know
- What is protocol-oriented programming?
- Introducing the protocol
- Adopting protocols
- Conforming to protocols via extensions
- Understanding polymorphism
- Protocol inheritance
- Adopting multiple protocols
- Protocol extensions
- Challenge: Removing tight coupling
- Solution: Removing tight coupling
- Why protocols?
- From unstructured code to POP
- Designing with classes: First try
- Designing with classes: Subclassing
- The benefits of thinking in protocols
- Highlighting the differences
- The importance of generics
- Defining generic functions and methods
- Working with generic types
- Placeholder types in protocols
- Using generics with protocols
- Challenge: Implementing a generic stack
- Solution: Implementing a generic stack
- Weather app design
- Defining the UI using SwiftUI
- The WebServiceController protocol
- Working with a third-party API
- Implementing the OpenWeatherMap controller
- Completing the OpenWeatherMap controller
- Introducing the view model
- Presenting weather data
- Challenge: Integrating a fallback service
- Solution: Integrating a fallback service
- Next steps
Taught by
Károly Nyisztor
Related Courses
Reviews
0.0 rating, based on 0 reviews