diff --git a/CountryPicker/Examples/CoCoaPods/CountryPickerExample.xcodeproj/project.pbxproj b/CountryPicker/Examples/CoCoaPods/CountryPickerExample.xcodeproj/project.pbxproj index c8790a1..5732051 100644 --- a/CountryPicker/Examples/CoCoaPods/CountryPickerExample.xcodeproj/project.pbxproj +++ b/CountryPicker/Examples/CoCoaPods/CountryPickerExample.xcodeproj/project.pbxproj @@ -352,7 +352,7 @@ INFOPLIST_KEY_UILaunchScreen_Generation = YES; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; - IPHONEOS_DEPLOYMENT_TARGET = 15; + IPHONEOS_DEPLOYMENT_TARGET = 17; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -382,7 +382,7 @@ INFOPLIST_KEY_UILaunchScreen_Generation = YES; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; - IPHONEOS_DEPLOYMENT_TARGET = 15; + IPHONEOS_DEPLOYMENT_TARGET = 17; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", diff --git a/CountryPicker/Examples/CoCoaPods/Pods/Pods.xcodeproj/project.pbxproj b/CountryPicker/Examples/CoCoaPods/Pods/Pods.xcodeproj/project.pbxproj index 540ae15..0e90511 100644 --- a/CountryPicker/Examples/CoCoaPods/Pods/Pods.xcodeproj/project.pbxproj +++ b/CountryPicker/Examples/CoCoaPods/Pods/Pods.xcodeproj/project.pbxproj @@ -877,7 +877,7 @@ 9933E789B88F88EDD78C57166F1B2888 /* DE@2x.png */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = image.png; name = "DE@2x.png"; path = "CountryPicker/Sources/CountryPickerController.bundle/DE@2x.png"; sourceTree = ""; }; 999A60228A3B97CC8B8F6074A4717942 /* MO@2x.png */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = image.png; name = "MO@2x.png"; path = "CountryPicker/Sources/CountryPickerController.bundle/MO@2x.png"; sourceTree = ""; }; 9B22A87E45E7035E839F0A120774108B /* CZ.png */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = image.png; name = CZ.png; path = CountryPicker/Sources/CountryPickerController.bundle/CZ.png; sourceTree = ""; }; - 9B364A8E6EE0C045E27D0EB39D8E699E /* Pods-CountryPickerExample */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = "Pods-CountryPickerExample"; path = Pods_CountryPickerExample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 9B364A8E6EE0C045E27D0EB39D8E699E /* Pods_CountryPickerExample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_CountryPickerExample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 9BCF20A96B1928AC424DB4FB47E01E9D /* BT@2x.png */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = image.png; name = "BT@2x.png"; path = "CountryPicker/Sources/CountryPickerController.bundle/BT@2x.png"; sourceTree = ""; }; 9BEAC62D01ED2811BF92C9B90BF13E3C /* VI.png */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = image.png; name = VI.png; path = CountryPicker/Sources/CountryPickerController.bundle/VI.png; sourceTree = ""; }; 9C6F63247861FDB42B8C280944175125 /* AU.png */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = image.png; name = AU.png; path = CountryPicker/Sources/CountryPickerController.bundle/AU.png; sourceTree = ""; }; @@ -1129,7 +1129,7 @@ 373CF1CE0EE1C3E14BFD3E548A6402E0 /* Products */ = { isa = PBXGroup; children = ( - 9B364A8E6EE0C045E27D0EB39D8E699E /* Pods-CountryPickerExample */, + 9B364A8E6EE0C045E27D0EB39D8E699E /* Pods_CountryPickerExample.framework */, E35D40CE0FDD4C4651AABDFD4367BC74 /* SKCountryPicker.framework */, DE277629B5C09BE727E2EA152C0F7D19 /* CountryPickerController.bundle */, ); @@ -1765,7 +1765,7 @@ ); name = "Pods-CountryPickerExample"; productName = Pods_CountryPickerExample; - productReference = 9B364A8E6EE0C045E27D0EB39D8E699E /* Pods-CountryPickerExample */; + productReference = 9B364A8E6EE0C045E27D0EB39D8E699E /* Pods_CountryPickerExample.framework */; productType = "com.apple.product-type.framework"; }; AD5DDE18FD5EB97540CD21988269989D /* SKCountryPicker-CountryPickerController */ = { @@ -2419,7 +2419,7 @@ CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/SKCountryPicker"; IBSC_MODULE = SKCountryPicker; INFOPLIST_FILE = "Target Support Files/SKCountryPicker/ResourceBundle-CountryPickerController-SKCountryPicker-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 15.0; + IPHONEOS_DEPLOYMENT_TARGET = 17.0; PRODUCT_NAME = CountryPickerController; SDKROOT = iphoneos; SKIP_INSTALL = YES; @@ -2444,7 +2444,7 @@ GCC_PREFIX_HEADER = "Target Support Files/SKCountryPicker/SKCountryPicker-prefix.pch"; INFOPLIST_FILE = "Target Support Files/SKCountryPicker/SKCountryPicker-Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 15.0; + IPHONEOS_DEPLOYMENT_TARGET = 17.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -2480,7 +2480,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = "Target Support Files/Pods-CountryPickerExample/Pods-CountryPickerExample-Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 15; + IPHONEOS_DEPLOYMENT_TARGET = 17.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -2580,7 +2580,7 @@ GCC_PREFIX_HEADER = "Target Support Files/SKCountryPicker/SKCountryPicker-prefix.pch"; INFOPLIST_FILE = "Target Support Files/SKCountryPicker/SKCountryPicker-Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 15.0; + IPHONEOS_DEPLOYMENT_TARGET = 17.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -2681,7 +2681,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = "Target Support Files/Pods-CountryPickerExample/Pods-CountryPickerExample-Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 15; + IPHONEOS_DEPLOYMENT_TARGET = 17.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -2710,7 +2710,7 @@ CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/SKCountryPicker"; IBSC_MODULE = SKCountryPicker; INFOPLIST_FILE = "Target Support Files/SKCountryPicker/ResourceBundle-CountryPickerController-SKCountryPicker-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 15.0; + IPHONEOS_DEPLOYMENT_TARGET = 17.0; PRODUCT_NAME = CountryPickerController; SDKROOT = iphoneos; SKIP_INSTALL = YES; diff --git a/Framework/Framework.xcodeproj/project.pbxproj b/Framework/Framework.xcodeproj/project.pbxproj index 0f4cc2c..3b8d6f5 100644 --- a/Framework/Framework.xcodeproj/project.pbxproj +++ b/Framework/Framework.xcodeproj/project.pbxproj @@ -329,7 +329,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 17.4; + IPHONEOS_DEPLOYMENT_TARGET = 17.6; LOCALIZATION_PREFERS_STRING_CATALOGS = YES; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; @@ -389,7 +389,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 17.4; + IPHONEOS_DEPLOYMENT_TARGET = 17.6; LOCALIZATION_PREFERS_STRING_CATALOGS = YES; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; diff --git a/Framework/Framework/Sources/CountryManager.swift b/Framework/Framework/Sources/CountryManager.swift index a278bb2..f15b83d 100644 --- a/Framework/Framework/Sources/CountryManager.swift +++ b/Framework/Framework/Sources/CountryManager.swift @@ -111,7 +111,7 @@ public extension CountryManager { func fetchCountries(fromURLPath path: URL) throws -> [Country] { guard let rawData = try? Data(contentsOf: path), let countryCodes = try? PropertyListSerialization.propertyList(from: rawData, format: nil) as? [String] else { - throw "[CountryManager] ❌ Missing countries plist file from path: \(path)" + throw CountryPickerError.couldNotLoadCountries } // Sort country list by `countryName` @@ -236,9 +236,15 @@ public extension CountryManager { } // MARK: - Error Handling -extension String: Error {} -extension String: LocalizedError { - public var errorDescription: String? { return self } +enum CountryPickerError: Error, LocalizedError { + case couldNotLoadCountries + + var errorDescription: String? { + switch self { + case .couldNotLoadCountries: + return "[CountryManager] ❌ Missing countries plist file from path" + } + } } // MARK: - Array Extension diff --git a/Framework/Framework/Sources/CountryPickerView.swift b/Framework/Framework/Sources/CountryPickerView.swift index 62b67e8..a03fad3 100644 --- a/Framework/Framework/Sources/CountryPickerView.swift +++ b/Framework/Framework/Sources/CountryPickerView.swift @@ -51,8 +51,8 @@ struct CountryPickerView: View { }.listStyle(.grouped) .searchable(text: $searchText) .navigationTitle("Country Picker") - .onChange(of: searchText) { newValue in - filterCountries = manager.filterCountries(searchText: newValue) + .onChange(of: searchText) { + filterCountries = manager.filterCountries(searchText: searchText) } .onDisappear { manager.lastCountrySelected = selectedCountry @@ -68,7 +68,7 @@ struct CountryPickerView: View { } } } - .onChange(of: selectedCountry) { _ in + .onChange(of: selectedCountry) { presentationMode.wrappedValue.dismiss() } } diff --git a/Framework/Framework/Sources/CountryPickerWheelView.swift b/Framework/Framework/Sources/CountryPickerWheelView.swift index a05597f..6cde599 100644 --- a/Framework/Framework/Sources/CountryPickerWheelView.swift +++ b/Framework/Framework/Sources/CountryPickerWheelView.swift @@ -22,7 +22,7 @@ struct CountryPickerWheelView: View { .pickerStyle(.wheel) } .onChange(of: selectedCountry) { - viewModel.dataSource.lastCountrySelected = $0 + viewModel.dataSource.lastCountrySelected = selectedCountry } .padding() } diff --git a/Framework/Framework/Sources/CountryPickerWithSections.swift b/Framework/Framework/Sources/CountryPickerWithSections.swift index bf49d8f..2773c57 100644 --- a/Framework/Framework/Sources/CountryPickerWithSections.swift +++ b/Framework/Framework/Sources/CountryPickerWithSections.swift @@ -57,10 +57,10 @@ struct CountryPickerWithSections: View { } } .onChange(of: searchText) { - viewModel.filterWithText($0) + viewModel.filterWithText(searchText) } .onChange(of: viewModel.selectedCountry) { - selectedCountry = $0 + selectedCountry = viewModel.selectedCountry presentationMode.wrappedValue.dismiss() }