Skip to content

Instantly share code, notes, and snippets.

@eofster
Last active November 10, 2015 11:26
Show Gist options
  • Save eofster/0e234ae6beec5d60978c to your computer and use it in GitHub Desktop.
Save eofster/0e234ae6beec5d60978c to your computer and use it in GitHub Desktop.
Phone call registry returning an optional phone call
protocol PhoneCallRegistry {
func callWithIdentifier(identifier: Int) -> PhoneCall?
}
func hangUpCallWithIdentifier(identifier: Int) {
if let call = phoneCallRegistry.callWithIdentifier(identifier) {
call.hangUp()
} else {
print("Could not hang up call")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment