EurekaCommunity / PostalAddressRow

An Eureka row that shows a series of UITextField's for the user to enter postal address information
MIT License
19 stars 10 forks source link

Country picker #3

Open marbetschar opened 7 years ago

marbetschar commented 7 years ago

What would be the best approach in adding a country picker to the PostalAddressRow?

My idea right now is:

  1. Add a UIButton named countryButton which can be used in a NIB instead of countryTextField.
  2. Assign all country iso codes to the PostalAddressRow.dataProvider as selectable default values
  3. Show a SelectorViewController for the current PostalAddressRow if the countryButton is tapped
  4. Store the selected country code of the SelectorViewController in the PostalAddress.country field of the row
  5. Dismiss the SelectorViewController
  6. Display the localized country name as label of the countryButton based upon the PostalAddress.country field
marbetschar commented 7 years ago

@mats-claassen any thoughts on this proposal?

mats-claassen commented 7 years ago

I think it makes sense and it would be a very nice feature. One thing that we have to decide is if the country value must be a country picked from the country picker or if we also want to support text input as it is now. Maybe we could support both and then PostalAddress.country would be an enum like:

enum PostalAddressCountry {
    case userInput(country: String)
    case isoCode(code: String)
}

This would be similar to the implementation of GooglePlacesRow

Also the SelectorViewController should be customizable. Ideally we should be able to specify the controller to be used for this.

And as you pointed out the countries names should be localized somehow.