Is it possible to create a function which can generate a UIAlertAction and return it with handler.
I just don't want to write code for UIAlertAction multiple times, only trying to create single function which can create the UIAlertAction for every required scenario. Here is my code.
UIAlertAction *actionPast = [self createActionButton:@"Past"];
UIAlertAction *actionFuture = [self createActionButton:@"Future"];
-(UIAlertAction *)createActionButton : (NSString *)title{
UIAlertAction *action = [UIAlertAction actionWithTitle:title style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {}];
return action;
}
So is there any possibility to revert handler and perform any task on click of any UIAlertAction.