Skip to content

Instantly share code, notes, and snippets.

@yakushevichsv
Last active June 21, 2021 18:40
Show Gist options
  • Save yakushevichsv/e0ad22a4b4af40b21871cc772c31dca8 to your computer and use it in GitHub Desktop.
Save yakushevichsv/e0ad22a4b4af40b21871cc772c31dca8 to your computer and use it in GitHub Desktop.
Dispatch execution to main thread from callback
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
}
}
@yakushevichsv
Copy link
Author

Initial commit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment