From the course: Practical Design Patterns in Swift

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Creational, structural, and behavioral patterns

Creational, structural, and behavioral patterns - Swift Tutorial

From the course: Practical Design Patterns in Swift

Start my 1-month free trial

Creational, structural, and behavioral patterns

- [Instructor] The Gang of Four group the software design patterns into three distinct categories: creational, structural, and behavioral. I'm going to show you life coding examples to demonstrate several patterns that fall into these categories. The creational design patterns are about object creation, and their purpose is to separate the usage of an object from its instantiation, thus we don't expose the creation details to the users of our objects. As a consequence, we simplify the usage of our objects and reduce the coupling within our system. We're going to talk about three creational design patterns. First, we'll delve into the Singleton pattern that's useful if we need to ensure that there's only one instance of a type. I'm going to show you how to implement the Singleton, and we'll also address the most significant challenge we encounter when working with this pattern. The Prototype design pattern comes next. The Prototype is concerned with the cloning of objects. We'll talk…

Contents