Skip to content

Commit

Permalink
Merge pull request #774 from OneBusAway/deprecation_fix
Browse files Browse the repository at this point in the history
Fix deprecation warnings for onChange(of:perform:) in iOS 17.0
  • Loading branch information
aaronbrethorst authored Nov 30, 2024
2 parents ee31db2 + dc32cf5 commit eaada00
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions OBAKit/Controls/Navigation/RenamableNavigationTitle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ fileprivate struct RenamableNavigationTitle<MenuItems: View>: ViewModifier {
// way to have an `onChange` to fire on initial value.
textFieldValue = title
}
.onChange(of: title) { newValue in
.onChange(of: title) { _, newValue in
textFieldValue = newValue
}
.onChange(of: isEditing) { newIsEditing in
.onChange(of: isEditing) { _, newIsEditing in
isFocusedOnTextField = newIsEditing
}
}
Expand Down
2 changes: 1 addition & 1 deletion OBAKit/Donations/DonationLearnMoreView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ struct DonationLearnMoreView: View {
.alert("Enter an amount in U.S. dollars", isPresented: otherAmountSelected) {
buildOtherAmountAlert()
}
.onChange(of: donationModel.donationComplete) { newValue in
.onChange(of: donationModel.donationComplete) { _, newValue in
guard newValue else { return }

let shouldDismiss: Bool
Expand Down
4 changes: 2 additions & 2 deletions OBAKit/Onboarding/RegionPicker/RegionPickerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ public struct RegionPickerView<Provider: RegionProvider>: View, OnboardingView {

// Lifecycle-related modifiers
.onAppear(perform: setCurrentRegionIfPresent)
.onChange(of: regionProvider.currentRegion) { [regionProvider] _ in
.onChange(of: regionProvider.currentRegion, initial: false) { _, newRegion in
// When the user selects to automatically select a region, update
// selectedRegion with the new current region.
if regionProvider.automaticallySelectRegion {
self.selectedRegion = regionProvider.currentRegion
self.selectedRegion = newRegion
}
}

Expand Down

0 comments on commit eaada00

Please sign in to comment.