Skip to content

Instantly share code, notes, and snippets.

@mzaks
Created October 21, 2016 12:49
Show Gist options
  • Select an option

  • Save mzaks/ef75ce74e1f89614de1b012c7ae72ab2 to your computer and use it in GitHub Desktop.

Select an option

Save mzaks/ef75ce74e1f89614de1b012c7ae72ab2 to your computer and use it in GitHub Desktop.
struct AskingForUsersName : Action {
func execute(data: String, callback: @escaping (DataType, BehaviourResult) -> ()) {
print("Who am I talking to?")
let name = readLine()
if let name = name, name.utf8.count > 0{
callback(name, .succeeded)
} else {
callback(data, .failed)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment