Reputation: 51
in objective c i write a method
-(void)loginApi:(NSMutableDictionary*)dict completion:(void(^)(NSDictionary *json,BOOL sucess))completion {
how we write same method
Upvotes: 1
Views: 582
Reputation: 2948
Although Previous answers will work I would suggest to alias it instead of typing the declaration every time (it also concern Objective c).
typealias CompletionHandlerType = (error:NSError ,response:AnyObject?) -> Void
Upvotes: 0
Reputation: 197
func loginApi(dict: NSMutableDictionary, completion: (json:NSDictionary,success: Bool) -> Void){
//Do whatever you want to do here
completion(json: dict, success: true) //This is just an example of how you can call
}
Give this a try. I think it should work. If not,let me know.
Upvotes: 1
Reputation: 2147
func loginApi(completion : (json: [Dictionary<String, String>, success: Bool]) -> [Dictionary<String Int>]) {
...
completion(...)
}
Upvotes: 0