Skip to content

Instantly share code, notes, and snippets.

@natanrolnik
Created February 12, 2019 13:06
Show Gist options
  • Save natanrolnik/6dbeaaef228253824457910a2f335831 to your computer and use it in GitHub Desktop.
Save natanrolnik/6dbeaaef228253824457910a2f335831 to your computer and use it in GitHub Desktop.
//keep a variable to know if the user tapped the button:
var micButtonTapped = false
func recordVoiceMessage() {
//if the user tapped/held the mic button, set the variable to true
micButtonTapped = true
}
//in your viewDidAppear method, schedule it:
DispatchQueue.main.asyncAfter(.now() + 3) { [weak self] in
//make sure the mic button wasn't used yet
guard self?.micButtonTapped == true else {
return
}
self?.micButton.jump()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment