typealias SuccessHandler = (NSURLSessionDataTask, AnyObject?) -> Void
This code block creates a type alias named SuccessHandler
, just in the same way var string = ""
creates a variable with the name string
.
Now whenever you use SuccessHandler
, for example:
func example(_ handler: SuccessHandler) {}
You are essentilly writing:
func example(_ handler: (NSURLSessionDataTask, AnyObject?) -> Void) {}