Skip to content

Instantly share code, notes, and snippets.

@eofster
Created November 10, 2015 12:20
Show Gist options
  • Save eofster/f0fd24cb9ba00d03e7a7 to your computer and use it in GitHub Desktop.
Save eofster/f0fd24cb9ba00d03e7a7 to your computer and use it in GitHub Desktop.
Guard statements when accessing first call of an account with identifier
func hangUpFirstCallOnAccountWithIdentifier(identifier: Int) {
guard let account = accountRegistry.accountWithIdentifier(identifier) else {
print("Could not find account")
return
}
guard let call = account.firstCall else {
print("Could not find first call for an account")
return
}
call.hangUp()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment