PostalAddressRow
PostalAddressRow copied to clipboard
Country picker
What would be the best approach in adding a country picker to the PostalAddressRow
?
My idea right now is:
- Add a
UIButton
namedcountryButton
which can be used in aNIB
instead ofcountryTextField
. - Assign all country iso codes to the
PostalAddressRow.dataProvider
as selectable default values - Show a
SelectorViewController
for the currentPostalAddressRow
if thecountryButton
is tapped - Store the selected country code of the
SelectorViewController
in thePostalAddress.country
field of the row - Dismiss the
SelectorViewController
- Display the localized country name as label of the
countryButton
based upon thePostalAddress.country
field
@mats-claassen any thoughts on this proposal?
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.