Swift 5: Protocol-Oriented Programming

Swift 5: Protocol-Oriented Programming

English | MP4 | AVC 1280×720 | AAC 48KHz 2ch | 2 Hours | 309 MB

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.

Topics include:

  • Comparing OOP with POP
  • Adopting a protocol
  • Working with generic types
  • Using generics with protocols
  • Implementing an app using POP
  • Integrating a fallback service
Table of Contents

1 Benefits Protocol-oriented programming
2 What you should know
3 What is protocol-oriented programming
4 Introducing the protocol
5 Adopting protocols
6 Conforming to protocols via extensions
7 Understanding polymorphism
8 Protocol inheritance
9 Adopting multiple protocols
10 Protocol extensions
11 Challenge Removing tight coupling
12 Solution Removing tight coupling
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
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
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
36 Next steps