tristanhimmelman / THContactPicker

An iOS view used for selecting contacts. This view is inspired by the contact selection in the iOS Mail and Messages apps
MIT License
663 stars 173 forks source link

Missing contactPickerView parameter in all delegate methods #33

Open tomaskraina opened 9 years ago

tomaskraina commented 9 years ago

A parameter that contains a reference to a sender (an instance of THContactPickerDelegate) is missing in all delegate methods. This violates both the best practice for delegate pattern and makes it difficult to handle multiple THContactPickerView instances in one single delegate.

For example when you have multiple contact pickers on one screen and all of them have the same delegate which is a view controller.

Proposed THContactPickerDelegate protocol should look like this:

@protocol THContactPickerDelegate <NSObject>

- (void)contactPicker:(THContactPickerView *)contactPickerView textViewDidChangeToText:(NSString *)text;
- (void)contactPicker:(THContactPickerView *)contactPickerView didRemoveContact:(id)contact;
- (void)contactPickerDidResize:(THContactPickerView *)contactPickerView;
- (BOOL)contactPicker:(THContactPickerView *)contactPickerView textFieldShouldReturn:(UITextField *)textField;

@end
tristanhimmelman commented 9 years ago

Hi @tomaskraina, I am in agreement with these recommendations and what you bring up in #34. If you have the time to create a Pull Request with these updates that would be great! Otherwise, it will take some time for me to get to this. Thanks