Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

LinkedIn Learning

Practical Design Patterns in Swift

via LinkedIn Learning


Build more functional, robust, and future-proof code using software design patterns. Learn how to implement the most popular "Gang of Four" design patterns with Swift.

The “Gang of Four” software design patterns have been around for decades. There’s a good reason they’re still so popular today. These patterns embody proven best practices that result in more functional, robust, and future-proof code. In this course, instructor Károly Nyistor teaches you how to implement the most useful design patterns in Swift, using features like protocol-oriented programming, type extensions, and value types. Learn about their benefits and limitations and then explore each group of patterns in detail. Károly reviews creational patterns such as Singleton, Prototype, and Factory Method; structural patterns including Adapter, Façade, and Proxy; and behavioral patterns such as Chain of Responsibility, Iterator, Observer, and State. Each tutorial includes coding examples that show how to implement the patterns in real-world projects.


  • Explore the benefits of design patterns
  • What you should know
1. Design Patterns: Values and Limitations
  • What’s a software design pattern?
  • Applications of design patterns
  • Limitations
  • Creational, structural, and behavioral patterns
2. The Singleton Pattern
  • Purpose, pros, and cons
  • Read-only singletons
  • Concurrency issues
  • Making the singleton thread-safe
  • Readers-writer lock
3. The Prototype Pattern
  • Purpose: Cloning
  • Copying value types
  • Pitfalls of cloning reference types
  • Cloning reference types
4. The Factory Method Pattern
  • Polymorphic instantiation
  • Implementing the Factory Method
5. The Adapter Pattern
  • Working with incompatible interfaces
  • Classical Adapter
  • Adapter using type extensions
6. The Decorator Pattern
  • Enhancing a type without modifying it
  • The object Decorator
  • Decorator via Swift extensions
7. The Facade Pattern
  • Purpose: Simplify usage
  • Consolidating complex functionality
8. The Flyweight Pattern
  • Sharing of common data
  • Spaceships
9. The Proxy Pattern
  • The surrogate
  • Delayed initialization
10. The Chain of Responsibility Pattern
  • Request propagation
  • Request processor
11. The Iterator Pattern
  • Sequential access
  • Custom queue implementation
  • Adding for-in loop support to the queue
12. The Observer Pattern
  • Broadcasting
  • Notifying observers
13. The State Pattern
  • Aim: Reduce complex conditional logic
  • Coffee machine with nested conditionals
  • Refactoring: Identifying the states
  • Refactoring: Implementing the states
  • Next steps

Taught by

Károly Nyisztor

Related Courses


Start your review of Practical Design Patterns in Swift

Never Stop Learning!

Get personalized course recommendations, track subjects and courses with reminders, and more.

Sign up for free