Last active
June 21, 2021 18:40
-
-
Save yakushevichsv/e0ad22a4b4af40b21871cc772c31dca8 to your computer and use it in GitHub Desktop.
Dispatch execution to main thread from callback
This file contains 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
receiveItems { //apparantly the method's declaration is that: receiveItems(completion: ()-> Void) | |
//do some processing in completion block | |
let items = ... | |
DispatchQueue.main.async { [weak self] in | |
// update ui | |
guard let self = self else { return } | |
self.items = items | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Initial commit