typealias for closures with parameters
suggest changetypealias 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) {}
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents