Created
December 10, 2017 16:05
-
-
Save svetlanama/9201b11dfc7ed7df1d2e1ebdb5580667 to your computer and use it in GitHub Desktop.
Return completionCallback after completing internal callbacks
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
private func initView(completionCallback: (() -> ())? = nil) { | |
var callbacksLeft = 2 | |
func checkCompleted() { | |
callbacksLeft -= 1 | |
if callbacksLeft == 0 { | |
completionCallback?() | |
} | |
} | |
connectSocketServer() { | |
checkCompleted() | |
} | |
loadPrivateMessages() { | |
checkCompleted() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment