Skip to content

Instantly share code, notes, and snippets.

@natanrolnik
Created February 12, 2019 13:06
Show Gist options
  • Save natanrolnik/96f28038cd67ec740584c6446a498f41 to your computer and use it in GitHub Desktop.
Save natanrolnik/96f28038cd67ec740584c6446a498f41 to your computer and use it in GitHub Desktop.
var micHintWorkItem: DispatchWorkItem?
func recordVoiceMessage() {
micHintWorkItem?.cancel()
}
//in your viewDidAppear method, create and schedule the work item:
micHintWorkItem = DispatchWorkItem { [weak self] in
self?.micButton.jump()
}
//we just created the work item, it is safe to force unwrap in this situation
DispatchQueue.main.asyncAfter(.now() + 3, execute: micHintWorkItem!)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment