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 selector #7

Open marbetschar opened 6 years ago

marbetschar commented 6 years ago

This pull request adds the ability to define a country selector using the newly added var countrySelectorRow : PushRow<String>? as discussed in https://github.com/EurekaCommunity/PostalAddressRow/issues/3.

To make use of this you'll define a PostalAddressRow like this (see the Example project):

<<< PostalAddressRow() {
    $0.streetPlaceholder = "Street"
    $0.statePlaceholder = "State"
    $0.cityPlaceholder = "City"
    $0.countryPlaceholder = "Country"
    $0.postalCodePlaceholder = "Zip code"

    $0.countrySelectorRow = PushRow<String>(){
        $0.options = ["GB","US"]
        $0.displayValueFor = { guard let isoCode = $0 else{ return nil }
            return Locale.current.localizedString(forRegionCode: isoCode)
        }
    }
}

If you want to use custom Nibs, you'll have to add a UITableView linked with @IBOutlet open var countrySelectorTableView: UITableView?.

And this is how it looks like:

picker detail

marbetschar commented 6 years ago

Any chance we can get this merged?

mats-claassen commented 6 years ago

Hi @marbetschar, sorry for the late reply.

Why did you use a UITableView with a PushRow instead or a simple button that pushes a SelectorViewController?

marbetschar commented 6 years ago

@mats-claassen main idea was to provide a way for further customization, using native Eureka features .... but looking back it might not made too much sense probably...?