From 0983b3b55356ef185cfe3aae15363d749ec571ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Nezan?= Date: Thu, 27 Feb 2020 12:18:54 +0100 Subject: [PATCH 1/4] [fix] Ordering countries by localized names --- CountryPickerView.podspec | 2 +- CountryPickerView/CountryPickerViewController.swift | 2 +- CountryPickerViewDemo/Podfile.lock | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CountryPickerView.podspec b/CountryPickerView.podspec index d35cbeb..eb79b52 100755 --- a/CountryPickerView.podspec +++ b/CountryPickerView.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |spec| spec.name = "CountryPickerView" - spec.version = "3.0.9" + spec.version = "3.0.10" spec.summary = "A simple, customizable view for selecting countries in iOS apps." spec.homepage = "https://github.com/kizitonwose/CountryPickerView" spec.license = "MIT" diff --git a/CountryPickerView/CountryPickerViewController.swift b/CountryPickerView/CountryPickerViewController.swift index 2e0327b..e8d828b 100644 --- a/CountryPickerView/CountryPickerViewController.swift +++ b/CountryPickerView/CountryPickerViewController.swift @@ -53,7 +53,7 @@ extension CountryPickerViewController { } groupedData.forEach{ key, value in groupedData[key] = value.sorted(by: { (lhs, rhs) -> Bool in - return lhs.name < rhs.name + return lhs.localizedName() ?? lhs.name < rhs.localizedName() ?? rhs.name }) } diff --git a/CountryPickerViewDemo/Podfile.lock b/CountryPickerViewDemo/Podfile.lock index 08dd9c5..9dcabbb 100644 --- a/CountryPickerViewDemo/Podfile.lock +++ b/CountryPickerViewDemo/Podfile.lock @@ -1,5 +1,5 @@ PODS: - - CountryPickerView (3.0.8) + - CountryPickerView (3.0.10) DEPENDENCIES: - CountryPickerView (from `../`) @@ -9,7 +9,7 @@ EXTERNAL SOURCES: :path: "../" SPEC CHECKSUMS: - CountryPickerView: d36c6fa3422671b1ba7c4d217e7367ca64de44e2 + CountryPickerView: 05725e8cc7cb5ac347b5153144354f8220cce51d PODFILE CHECKSUM: 649829ad9a32abd953e33364dc48a4a40a615047 From 1e6159747caca51accce9096841ce650d6fef1e9 Mon Sep 17 00:00:00 2001 From: Kizito Nwose Date: Sun, 1 Mar 2020 19:08:17 +0100 Subject: [PATCH 2/4] Respect the locale in the data source when sorting. --- CountryPickerView/CountryPickerViewController.swift | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CountryPickerView/CountryPickerViewController.swift b/CountryPickerView/CountryPickerViewController.swift index e8d828b..1a6a519 100644 --- a/CountryPickerView/CountryPickerViewController.swift +++ b/CountryPickerView/CountryPickerViewController.swift @@ -46,14 +46,15 @@ extension CountryPickerViewController { func prepareTableItems() { if !showOnlyPreferredSection { let countriesArray = countryPickerView.countries + let locale = dataSource.localeForCountryNameInList var groupedData = Dictionary(grouping: countriesArray) { - let name = $0.localizedName(dataSource.localeForCountryNameInList) ?? $0.name + let name = $0.localizedName(locale) ?? $0.name return String(name.capitalized[name.startIndex]) } groupedData.forEach{ key, value in groupedData[key] = value.sorted(by: { (lhs, rhs) -> Bool in - return lhs.localizedName() ?? lhs.name < rhs.localizedName() ?? rhs.name + return lhs.localizedName(locale) ?? lhs.name < rhs.localizedName(locale) ?? rhs.name }) } From 6e8c89c7641e71be96b0db06166927f1caeeb24e Mon Sep 17 00:00:00 2001 From: Kizito Nwose Date: Sun, 1 Mar 2020 19:13:50 +0100 Subject: [PATCH 3/4] Update podspec. --- CountryPickerView.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CountryPickerView.podspec b/CountryPickerView.podspec index eb79b52..4624fa7 100755 --- a/CountryPickerView.podspec +++ b/CountryPickerView.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |spec| spec.name = "CountryPickerView" - spec.version = "3.0.10" + spec.version = "3.1.0" spec.summary = "A simple, customizable view for selecting countries in iOS apps." spec.homepage = "https://github.com/kizitonwose/CountryPickerView" spec.license = "MIT" From 6cd7682d3a2f3362381f29f4f64789b83e5857fa Mon Sep 17 00:00:00 2001 From: Kizito Nwose Date: Sun, 1 Mar 2020 19:23:00 +0100 Subject: [PATCH 4/4] Update demo project to the latest release. --- CountryPickerViewDemo/Podfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CountryPickerViewDemo/Podfile.lock b/CountryPickerViewDemo/Podfile.lock index 9dcabbb..6dc7b12 100644 --- a/CountryPickerViewDemo/Podfile.lock +++ b/CountryPickerViewDemo/Podfile.lock @@ -1,5 +1,5 @@ PODS: - - CountryPickerView (3.0.10) + - CountryPickerView (3.1.0) DEPENDENCIES: - CountryPickerView (from `../`) @@ -9,7 +9,7 @@ EXTERNAL SOURCES: :path: "../" SPEC CHECKSUMS: - CountryPickerView: 05725e8cc7cb5ac347b5153144354f8220cce51d + CountryPickerView: ab341e2253d5e1231ff679ec93441e413703cb9c PODFILE CHECKSUM: 649829ad9a32abd953e33364dc48a4a40a615047