Design pattern programmers must have basic knowledge, but it is not easy to master without a year, so examples are very important. Concepts are abstract; examples are concrete. Concrete things are easier to remember and understand.
The purpose of the project was to collect classic and appropriate examples to help understand design patterns, so that people writing code and looking at other people’s code would be easier. We really hope that you can participate in the maintenance together.
Project address: github.com/swiftdo/des…
basis
- Relationships between classes
- Design principles
Create a type
These design patterns provide a way to hide the creation logic while creating objects, rather than instantiating objects directly using the new operator. This gives the program more flexibility in deciding which objects to create for a given instance.
- The factory pattern
- Builder model
- The prototype pattern
- The singleton pattern
structured
These design patterns focus on combinations of classes and objects. The concept of inheritance is used to combine interfaces and define how composite objects acquire new functionality.
- Adapter mode
- The bridge model
- Filter mode
- Portfolio model
- Decorator mode
- The appearance model
- The flyweight pattern
- The proxy pattern
Behavior type
These design patterns are particularly concerned with communication between objects.
- Chain of Responsibility model
- Command mode
- Interpreter mode
- Iterator pattern
- The mediator pattern
- Memo mode
- Observer model
- The state pattern
- Empty object mode
- The strategy pattern
- Template pattern
- Visitor pattern
communication
If you have a better case, don’t mention issue or PR. Of course, if there are improper words are also welcome to point out.
If you want to join our Swift wechat communication group, you can follow OldBirds on wechat