Skip to content

Commit df47d32

Browse files
authored
[WCiOS17] Update .onchange() usage to iOS17 API v2 (#16080)
2 parents 03f2ff1 + 3d22653 commit df47d32

File tree

13 files changed

+26
-25
lines changed

13 files changed

+26
-25
lines changed

RELEASE-NOTES.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
23.3
55
-----
6-
6+
- [internal] Address deprecated view modifiers usage following iOS17 API updates [https://github.com/woocommerce/woocommerce-ios/pull/16080]
77

88
23.2
99
-----
@@ -18,7 +18,6 @@
1818
- [***] Increased app's minimum deployment target to iOS17 [https://github.com/woocommerce/woocommerce-ios/pull/16003]
1919
- [*] Jetpack setup: Native experience for the connection step [https://github.com/woocommerce/woocommerce-ios/pull/15983]
2020
- [*] Payments: Updated the In-Person Payments `Learn More` redirection to display the correct page based on the selected payment provider [https://github.com/woocommerce/woocommerce-ios/pull/15998]
21-
- [internal] Address deprecated view modifiers usage following iOS17 API updates [https://github.com/woocommerce/woocommerce-ios/pull/16002]
2221
- [*] Add "POS" label in Most recent orders in My store dashboard [https://github.com/woocommerce/woocommerce-ios/pull/16006]
2322
- [*] Order details: Always show shipping labels section if order is eligible for label creation. [https://github.com/woocommerce/woocommerce-ios/pull/16010]
2423
- [*] Order details: Remove print buttons from shipment details [https://github.com/woocommerce/woocommerce-ios/pull/16012]

WooCommerce/Classes/Authentication/Jetpack Setup/Native Jetpack Setup/JetpackSetupView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ struct JetpackSetupView: View {
288288
.renderedIf(viewModel.setupFailed)
289289
})
290290
.padding()
291-
.onChange(of: viewModel.shouldPresentWebView) { shouldPresent in
291+
.onChange(of: viewModel.shouldPresentWebView) { _, shouldPresent in
292292
if shouldPresent {
293293
webViewPresentationHandler()
294294
}

WooCommerce/Classes/View Modifiers/View+Measurements.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ extension View {
1414
.onAppear {
1515
callback(proxy.size.height)
1616
}
17-
.onChange(of: proxy.size.height) { newHeight in
17+
.onChange(of: proxy.size.height) { _, newHeight in
1818
callback(newHeight)
1919
}
2020
}
@@ -32,7 +32,7 @@ extension View {
3232
.onAppear {
3333
callback(proxy.size.width)
3434
}
35-
.onChange(of: proxy.size.width) { newWidth in
35+
.onChange(of: proxy.size.width) { _, newWidth in
3636
callback(newWidth)
3737
}
3838
}
@@ -48,10 +48,10 @@ extension View {
4848
.onAppear {
4949
callback(proxy.frame(in: .global))
5050
}
51-
.onChange(of: proxy.size.height) { newHeight in
51+
.onChange(of: proxy.size.height) { _, newHeight in
5252
callback(proxy.frame(in: .global))
5353
}
54-
.onChange(of: proxy.frame(in: .global)) { newHeight in
54+
.onChange(of: proxy.frame(in: .global)) { _, newHeight in
5555
callback(proxy.frame(in: .global))
5656
}
5757
}

WooCommerce/Classes/ViewRelated/Authentication/AccountCreationForm.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ struct AccountCreationForm: View {
125125
}
126126
.background(Color(uiColor: .systemBackground))
127127
}
128-
.onChange(of: viewModel.shouldTransitionToPasswordField) { shouldTransition in
128+
.onChange(of: viewModel.shouldTransitionToPasswordField) { _, shouldTransition in
129129
if shouldTransition {
130130
withAnimation {
131131
viewModel.transitionToPasswordField()

WooCommerce/Classes/ViewRelated/Blaze/AdDestination/BlazeAddParameterView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ struct BlazeAddParameterView: View {
2121
.frame(width: Layout.keyWidth, alignment: .leading)
2222
TextField(Localization.keyLabel, text: $viewModel.key)
2323
}
24-
.onChange(of: viewModel.key) { _ in
24+
.onChange(of: viewModel.key) { _, _ in
2525
viewModel.validateInputs()
2626
}
2727

@@ -31,7 +31,7 @@ struct BlazeAddParameterView: View {
3131
.frame(width: Layout.keyWidth, alignment: .leading)
3232
TextField(Localization.valueLabel, text: $viewModel.value)
3333
}
34-
.onChange(of: viewModel.value) { _ in
34+
.onChange(of: viewModel.value) { _, _ in
3535
viewModel.validateInputs()
3636
}
3737
} footer: {

WooCommerce/Classes/ViewRelated/Blaze/CampaignCreation/BlazeCampaignCreationForm.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ struct BlazeCampaignCreationForm: View {
222222
isShowingCampaignObjectivePicker = false
223223
}
224224
}
225-
.onChange(of: viewModel.error) { newValue in
225+
.onChange(of: viewModel.error) { _, newValue in
226226
isShowingAISuggestionsErrorAlert = newValue == .failedToLoadAISuggestions
227227
}
228228
.alert(Localization.AISuggestionsErrorAlert.fetchingAISuggestions, isPresented: $isShowingAISuggestionsErrorAlert) {

WooCommerce/Classes/ViewRelated/Orders/Order Details/Shipping Labels/WooShipping Create Shipping Labels/WooShipping Package and Rate Selection/WooAddCustomPackageView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,10 @@ struct WooAddCustomPackageView: View {
149149
.padding(.horizontal)
150150
.frame(minHeight: geometry.size.height)
151151
.frame(width: geometry.size.width)
152-
.onChange(of: viewModel.showSaveTemplate) { newValue in
152+
.onChange(of: viewModel.showSaveTemplate) { _, newValue in
153153
packageTemplateNameFieldFocused = newValue
154154
}
155-
.onChange(of: packageTemplateNameFieldFocused) { focused in
155+
.onChange(of: packageTemplateNameFieldFocused) { _, focused in
156156
if focused {
157157
// More info about why small delay is added:
158158
// - https://github.com/woocommerce/woocommerce-ios/pull/14086#discussion_r1806036901

WooCommerce/Classes/ViewRelated/Orders/Order Details/Shipping Labels/WooShipping Create Shipping Labels/WooShippingAddresses/WooShippingEditAddressView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ struct WooShippingEditAddressView: View {
8585
}
8686
}
8787
.padding()
88-
.onChange(of: focusedField) { newField in
88+
.onChange(of: focusedField) { _, newField in
8989
if let previousFocusedField {
9090
viewModel.validate(previousFocusedField)
9191
}
@@ -262,7 +262,7 @@ struct WooShippingEditAddressView: View {
262262
TextField(Localization.title(for: field.type), text: $field.value, prompt: Text(field.required ? "" : Localization.optional))
263263
.keyboardType(keyboardType)
264264
.focused($focused, equals: field.type)
265-
.onChange(of: field.value) { _ in
265+
.onChange(of: field.value) {
266266
field.clearError()
267267
}
268268
.padding()

WooCommerce/Classes/ViewRelated/Products/Add Product/AddProductWithAI/Preview/ProductDetailPreviewView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ struct ProductDetailPreviewView: View {
134134
.onDisappear {
135135
viewModel.onViewDisappear()
136136
}
137-
.onChange(of: viewModel.errorState) { newValue in
137+
.onChange(of: viewModel.errorState) { _, newValue in
138138
isShowingErrorAlert = newValue != .none
139139
}
140140
.alert(viewModel.errorState.errorMessage, isPresented: $isShowingErrorAlert) {

WooCommerce/Classes/ViewRelated/Products/Add Product/AddProductWithAI/StartingInfo/ProductCreationAIStartingInfoView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,11 @@ private extension ProductCreationAIStartingInfoView {
102102
.padding(insets: Layout.messageContentInsets)
103103
.focused($editorIsFocused)
104104
// Scrolls to the "TextField" view with a smooth animation while typing.
105-
.onChange(of: viewModel.features) { _ in
105+
.onChange(of: viewModel.features) { _, _ in
106106
scrollToTextField(using: proxy)
107107
}
108108
// Scrolls to the "TextField" view with a smooth animation when the editor is focused in a small screen.
109-
.onChange(of: editorIsFocused) { isFocused in
109+
.onChange(of: editorIsFocused) { _, isFocused in
110110
if isFocused {
111111
scrollToTextField(using: proxy)
112112
}

0 commit comments

Comments
 (0)