Skip to content

Commit

Permalink
Merge pull request #123 from SuryakantRapido/feature/Swift_6Ready
Browse files Browse the repository at this point in the history
Feature/swift 6 ready
  • Loading branch information
SURYAKANTSHARMA authored Oct 30, 2024
2 parents 78c20e6 + d7a0d7c commit 8c298fc
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Framework/Framework.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
14 changes: 10 additions & 4 deletions Framework/Framework/Sources/CountryManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions Framework/Framework/Sources/CountryPickerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -68,7 +68,7 @@ struct CountryPickerView: View {
}
}
}
.onChange(of: selectedCountry) { _ in
.onChange(of: selectedCountry) {
presentationMode.wrappedValue.dismiss()
}
}
Expand Down
2 changes: 1 addition & 1 deletion Framework/Framework/Sources/CountryPickerWheelView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ struct CountryPickerWheelView: View {
.pickerStyle(.wheel)
}
.onChange(of: selectedCountry) {
viewModel.dataSource.lastCountrySelected = $0
viewModel.dataSource.lastCountrySelected = selectedCountry
}
.padding()
}
Expand Down
4 changes: 2 additions & 2 deletions Framework/Framework/Sources/CountryPickerWithSections.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand Down

0 comments on commit 8c298fc

Please sign in to comment.