mirror of
https://github.com/jphong1111/awesome-ios-developer.git
synced 2025-01-03 13:31:09 +07:00
update dependency injection
This commit is contained in:
parent
60dec3f4cb
commit
87915b885c
@ -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()
|
||||||
|
Loading…
Reference in New Issue
Block a user