I need to extract code from
[NSURLConnection sendAsynchronousRequest:request
queue:[NSOperationQueue mainQueue]
completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) {
[self doSomethingWithData:data];
outstandingRequests--;
if (outstandingRequests == 0) {
[self doSomethingElse];
}
}];
to
void AsynchronousRequestCompletionHandler (NSURLResponse *response, NSData *data, NSError *error)
{
...
}
but I can't:
in xamarin iOS i did it: instead this
TextLogin.ShouldChangeCharacters += () => { some code...};
made this:
TextLogin.ShouldChangeCharacters += LoginAndPassValidator;
// ... some code
bool LoginAndPassValidator (UITextField textField, NSRange range, string replacementString)
{
BtnLogin.Enabled = (!String.IsNullOrWhiteSpace (TextLogin.Text)) && (!String.IsNullOrEmpty (TextPass.Text));
if (BtnLogin.Enabled) {
BtnLogin.SetTitleColor (UIColor.Black, UIControlState.Normal);
} else {
BtnLogin.SetTitleColor (UIColor.Gray, UIControlState.Normal);
}
return true;
}
Can I make this extraction in obj C?