Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save oliverbarreto/1bd5cd57a4555bd1fd82 to your computer and use it in GitHub Desktop.
Save oliverbarreto/1bd5cd57a4555bd1fd82 to your computer and use it in GitHub Desktop.
Adding Swift Closures as values to Swift dictionary
class CommandResolver {
typealias MyBlock = () -> Void
private var commandDict:[String : MyBlock]= [String:MyBlock]()
init() {
self.setUpCommandDict();
}
func setUpCommandDict() {
self.commandDict["OpenAssessment_1"] = {
println("I am inside closure");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment