Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/RefactoringGuru/design-patterns-swift
Design Pattern Examples in Swift
https://github.com/RefactoringGuru/design-patterns-swift
design-patterns swift
Last synced: 4 months ago
JSON representation
Design Pattern Examples in Swift
- Host: GitHub
- URL: https://github.com/RefactoringGuru/design-patterns-swift
- Owner: RefactoringGuru
- License: other
- Created: 2018-04-30T13:34:08.000Z (almost 7 years ago)
- Default Branch: main
- Last Pushed: 2024-04-13T11:39:34.000Z (10 months ago)
- Last Synced: 2024-08-01T12:32:54.669Z (7 months ago)
- Topics: design-patterns, swift
- Language: Swift
- Homepage: https://refactoring.guru/design-patterns/swift
- Size: 1.91 MB
- Stars: 147
- Watchers: 9
- Forks: 32
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Design Patterns in Swift
This repository is part of the [Refactoring.Guru](https://refactoring.guru/design-patterns) project.
It contains Swift examples for all classic GoF design patterns.
There are two examples for each of the patterns:
- **Conceptual** examples illustrate the internal structure of a pattern, explained with detailed comments.
- **RealWorld** examples illustrate how patterns can be used in real-world Swift applications.
## Requirements
For the best experience, we recommend working with examples with [Swift 5](https://github.com/apple/swift) and [Xcode](https://developer.apple.com/xcode/) IDE.
## Usage
For the sake of simplicity, we tried to limit the scope of these examples to the code, related to the actual patterns. That's why didn't implement full-blown Swift apps, accompanied with Run targets. Instead, our examples are packaged as unit tests, where each Unit Test target executes a specific example of a pattern.
To run an example, browse it in the project directory, select the Unit Test scheme and launch the example.

## FAQ
#### 1. What is the _Client Code_?
_Client_ means _client of classes, defined as part of a pattern_, which is merely a caller of the given methods or a user of the given classes. In other words, it's the part of your application's code that uses the pattern's classes.
#### 2. I don't understand the roles you're referring to in RealWorld examples.
Take a look at the structural example first. There you'll find detailed descriptions of each class in a pattern, its role, and connection to other classes.
## License
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
## Credits
"Design Patterns in Swift" were created by [Maxim Eremenko](https://www.linkedin.com/in/maxim-eremenko/) for Refactoring.Guru.