Skip to content

Instantly share code, notes, and snippets.

@anuragajwani
Created February 17, 2017 13:34
Show Gist options
  • Save anuragajwani/2f0a5c24022fd709c246794cd8b0dda0 to your computer and use it in GitHub Desktop.
Save anuragajwani/2f0a5c24022fd709c246794cd8b0dda0 to your computer and use it in GitHub Desktop.
final class MyProtocolSharedInstanceSetter {
private let myProtocol: MyProtocol
init(myProtocol: MyProtocol, myApi: MyApi) {
self.myProtocol = myProtocol
myApi.getRequest(onCompletion: { [weak self] in myProtocol.sharedInstance = $0 }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment