From d8e3b63f5fb7310690dfc87fc3719ee9a39dbd29 Mon Sep 17 00:00:00 2001 From: Kizito Nwose Date: Sat, 18 Apr 2020 16:42:05 +0200 Subject: [PATCH 1/2] Notify delegate when selected country is set programmatically. --- CountryPickerView/CountryPickerView.swift | 3 ++- CountryPickerView/CountryPickerViewController.swift | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CountryPickerView/CountryPickerView.swift b/CountryPickerView/CountryPickerView.swift index c22e614..f811e6d 100644 --- a/CountryPickerView/CountryPickerView.swift +++ b/CountryPickerView/CountryPickerView.swift @@ -105,6 +105,7 @@ public class CountryPickerView: NibView { } set { _selectedCountry = newValue + delegate?.countryPickerView(self, didSelectCountry: newValue) setup() } } @@ -202,7 +203,7 @@ public class CountryPickerView: NibView { //MARK: Helper methods extension CountryPickerView { public func setCountryByName(_ name: String) { - if let country = countries.first(where: { $0.name == name }){ + if let country = countries.first(where: { $0.name == name }) { selectedCountry = country } } diff --git a/CountryPickerView/CountryPickerViewController.swift b/CountryPickerView/CountryPickerViewController.swift index 1a6a519..e2b7166 100644 --- a/CountryPickerView/CountryPickerViewController.swift +++ b/CountryPickerView/CountryPickerViewController.swift @@ -197,7 +197,6 @@ extension CountryPickerViewController { let completion = { self.countryPickerView.selectedCountry = country - self.countryPickerView.delegate?.countryPickerView(self.countryPickerView, didSelectCountry: country) } // If this is root, dismiss, else pop if navigationController?.viewControllers.count == 1 { From f3b224f3ff66a5b8c2442b55759ed057ed3389a5 Mon Sep 17 00:00:00 2001 From: Kizito Nwose Date: Sat, 18 Apr 2020 16:44:09 +0200 Subject: [PATCH 2/2] Update podspec. --- CountryPickerView.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CountryPickerView.podspec b/CountryPickerView.podspec index 2fc5406..006af6f 100755 --- a/CountryPickerView.podspec +++ b/CountryPickerView.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |spec| spec.name = "CountryPickerView" - spec.version = "3.1.1" + spec.version = "3.1.2" spec.summary = "A simple, customizable view for selecting countries in iOS apps." spec.homepage = "https://github.com/kizitonwose/CountryPickerView" spec.license = "MIT"