This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| protocol MyProtocol: class { | |
| var sharedInstance: Any? { get set } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| final class MyProtocolSharedInstanceSetter { | |
| private let myProtocol: MyProtocol | |
| init(myProtocol: MyProtocol, myApi: MyApi) { | |
| self.myProtocol = myProtocol | |
| myApi.getRequest(onCompletion: { [weak self] in myProtocol.sharedInstance = $0 } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| final class DefaultMyProtocol: MyProtocol { | |
| var sharedInstance: Any? = nil | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| protocol MyProtocol { | |
| var sharedInstance: Any? { get set } | |
| } |
NewerOlder