Beginner here, hopefully a simple question about preventing code duplication.
If you have code that detects what is being typed in a UITextView
(ie. regex for validation purposes), and you want that code to apply to multiple UITextView
's on different screens, how do you go about doing that rather than just duplicating that code in each and every UIViewController
that utilizes that UITextView
?
i.e.
-(BOOL)textField:(UITextField*)textFieldshouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string;