Book Image

Mastering Swift

By : Jon Hoffman
Book Image

Mastering Swift

By: Jon Hoffman

Overview of this book

Table of Contents (22 chapters)
Mastering Swift
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Creational patterns


Creational patterns are design patterns that deal with how an object is created. These patterns create objects in a manner that is suitable for the situation. There are two basic ideas behind creational patterns. The first is encapsulating the knowledge of which concrete classes should be created and the second is hiding how instances of these classes are created.

There are five well-known patterns that are part of the creational pattern category. These are as follows:

  • Abstract factory pattern: This provides an interface for creating related objects without specifying the concrete class

  • Builder pattern: This separates the construction of a complex object from its representation so the same process can be used to create similar types

  • Factory method pattern: This creates objects without exposing the underlying logic of how the object or which type is created

  • Prototype pattern: This creates an object by cloning an existing one

  • Singleton pattern: This allows one and only one instance...