rmaddy / RMPhoneFormat

RMPhoneFormat provides a simple to use class for formatting phone numbers in iOS apps. The formatting should replicate what you would see in the Contacts app for the same phone number.
266 stars 61 forks source link

Add CallingCodeInfo object to public interface #2

Closed rromanchuk closed 11 years ago

rromanchuk commented 11 years ago

it would be cool if there was a way to grab the updated CallingCodeInfo object from an instance of RMPhoneFormat so the client can easily grab parsed information about the current string thats being processed.

I can make the change if you don't see anything architecturally incorrect

rmaddy commented 11 years ago

The CallingCodeInfo is a private implementation detail. It is not something I'd like to see exposed to the public API. Of course you are free to do so in your own copy of the code. Feel free to create a fork and make whatever changes suit your needs. Enjoy.

rromanchuk commented 11 years ago

Yeah I have, maybe not this entire dictionary, but I just thought it would be nice if the client could ask "What is the country code for this string?" Once the string is formatted and valid there's no good way to get it's pieces back without basically reimplementing the entire library. There is also no way to get the unformatted string back, these are valuable for anyone who is working push form data to an API.

rmaddy commented 11 years ago

Adding a method that takes a phone number string and returns its country code makes sense. I will consider adding that feature.

There is no need to get the "unformatted string" back. Your own code already has a reference to the string you pass into RMPhoneFormat.