Created
October 21, 2016 12:49
-
-
Save mzaks/ef75ce74e1f89614de1b012c7ae72ab2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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