PostalAddressRow icon indicating copy to clipboard operation
PostalAddressRow copied to clipboard

Country selector

Open marbetschar opened this issue 7 years ago • 3 comments

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 avatar Jan 05 '18 18:01 marbetschar

Any chance we can get this merged?

marbetschar avatar Mar 02 '18 12:03 marbetschar

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?

mats-claassen avatar Mar 02 '18 18:03 mats-claassen

@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...?

marbetschar avatar Mar 06 '18 11:03 marbetschar