alexrothenberg / motion-addressbook

MIT License
89 stars 30 forks source link

Adds a block-based interface for the ABPeoplePickerNavigationController #6

Closed colinta closed 11 years ago

colinta commented 11 years ago

As much fun as that class is to type... ;-)

AddressBook.pick { |person|
  puts person.inspect
}

person will be nil or an instance of AddressBook::Person

Uses the AddressBook::Picker class, which stores a singleton reference to itself and assigns itself as a delegate to an instance of ABPeoplePickerNavigationController.

alexrothenberg commented 11 years ago

Thanks for this it looks nice. I'd just like to add some tests for it before merging.

Also a style question: is there any reason you made the main methods class methods but the delegate is an instance?

colinta commented 11 years ago

any reason you made the main methods class methods but the delegate is an instance

Hm, I didn't consider making those delegate methods class methods, I suppose it would work. No particular reason, though.

I started to write tests, but figured we could get to it before merging, like you said. I don't know when I'll be able to come back and do that. I'm fighting a heck of a deadline right now...

alexrothenberg commented 11 years ago

I took a pass at refactoring the class and it seems to work when I test manually but I can't figure out how to write specs for it.

The cleanest way I could figure out how to do this in github was to create a branch on my repo with your and my changes.

https://github.com/alexrothenberg/motion-addressbook/tree/colinta-pull-6

WDYT?

colinta commented 11 years ago

neat. I just now noticed the "WDYT" note. I think it sounds good! :-)

alexrothenberg commented 11 years ago

I just pushed v0.1.2 with this.

Thanks again for adding this.