Skip to content

Instantly share code, notes, and snippets.

@haikieu
Created August 15, 2018 07:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save haikieu/4c5c07460eae87f518aad32212888d31 to your computer and use it in GitHub Desktop.
Save haikieu/4c5c07460eae87f518aad32212888d31 to your computer and use it in GitHub Desktop.
function with golden path
func authenticateUser(_ username: String?, with password: String?) -> Bool {
guard let username = username, let password = password else {
//Bad input, do something and return
...
return false
}
//Golden path, everything goes well so far
let found = lookupDatabase(username, password)
return found
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment