update dependency injection

This commit is contained in:
Jungpyo Hong 2021-06-23 05:37:35 -05:00 committed by GitHub
parent 60dec3f4cb
commit 87915b885c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -23,6 +23,7 @@ Feel free to fork this repository and pull requests!!
- [Design Pattern](#Design-Pattern) - [Design Pattern](#Design-Pattern)
- [Adaptor](#Adaptor) - [Adaptor](#Adaptor)
- [Delegation](#Delegation) - [Delegation](#Delegation)
- [Dependency Injection](#Dependency-Injection)
- [Factory](#Factory) - [Factory](#Factory)
- [Observer](#Observer) - [Observer](#Observer)
- [KVO](#KVO) - [KVO](#KVO)
@ -155,6 +156,10 @@ Check [this](https://refactoring.guru/design-patterns/swift) website for design
```swift ```swift
weak var delegate: SomeProtocol? weak var delegate: SomeProtocol?
``` ```
## Dependency Injection
[Nuts and Bolts of Dependency Injection in Swift](https://cocoacasts.com/nuts-and-bolts-of-dependency-injection-in-swift)
## Factory ## Factory
@ -183,6 +188,8 @@ For more info, go [Apple Developer Site](https://developer.apple.com/documentati
## Singleton ## Singleton
singleton pattern is to ensure only one instance of a class is alive at any one time.
```swift ```swift
class SingletonPattern { class SingletonPattern {
static let manager = SingletonPattern() static let manager = SingletonPattern()