Skip to content

Commit 99828ba

Browse files
author
Oktawian Chojnacki
committed
* 'master' of https://github.com/ochococo/Design-Patterns-In-Swift: Private initialization to ensure just one instance is created. # Conflicts: # Design-Patterns.playground.zip
2 parents e0d7abb + 28cd0f1 commit 99828ba

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

Design-Patterns.playground.zip

38 Bytes
Binary file not shown.

Design-Patterns.playground/contents.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -765,6 +765,10 @@ There are very few applications, do not overuse this pattern!
765765
*/
766766
class DeathStarSuperlaser {
767767
static let sharedInstance = DeathStarSuperlaser()
768+
769+
private init() {
770+
// Private initialization to ensure just one instance is created.
771+
}
768772
}
769773
/*:
770774
### Usage:

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,10 @@ There are very few applications, do not overuse this pattern!
830830
```swift
831831
class DeathStarSuperlaser {
832832
static let sharedInstance = DeathStarSuperlaser()
833+
834+
private init() {
835+
// Private initialization to ensure just one instance is created.
836+
}
833837
}
834838
```
835839

source/creational/singleton.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ There are very few applications, do not overuse this pattern!
1010
*/
1111
class DeathStarSuperlaser {
1212
static let sharedInstance = DeathStarSuperlaser()
13+
14+
private init() {
15+
// Private initialization to ensure just one instance is created.
16+
}
1317
}
1418
/*:
1519
### Usage:

0 commit comments

Comments
 (0)