Reputation: 400
Supposing I have a class with class methods only and within a method I have two NSURLSessionDataTask / NSURLSessionUploadTask instances which have a completion handler like this:
^(NSData *responseData, NSURLResponse *response, NSError *error){
//here parsing the response etc.
}
which are 100% identical for both tasks.
What's the best way for me to create one completion handler in a class to use for both of them?
Upvotes: 0
Views: 72
Reputation: 11724
Simply add a Class method that returns this completion handler, this way both other methods can call this one.
Upvotes: 4