From b01934a50c3a369c66f8b535a0470ceb36906cb9 Mon Sep 17 00:00:00 2001 From: iamgabrielma Date: Thu, 4 Sep 2025 16:04:08 +0700 Subject: [PATCH 1/5] onchange updates to blaze --- .../Blaze/AdDestination/BlazeAddParameterView.swift | 4 ++-- .../Blaze/BlazeCampaignList/BlazeCampaignListView.swift | 2 +- .../Blaze/CampaignCreation/BlazeCampaignCreationForm.swift | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/WooCommerce/Classes/ViewRelated/Blaze/AdDestination/BlazeAddParameterView.swift b/WooCommerce/Classes/ViewRelated/Blaze/AdDestination/BlazeAddParameterView.swift index ce77a2d4b5a..4b89218ef89 100644 --- a/WooCommerce/Classes/ViewRelated/Blaze/AdDestination/BlazeAddParameterView.swift +++ b/WooCommerce/Classes/ViewRelated/Blaze/AdDestination/BlazeAddParameterView.swift @@ -21,7 +21,7 @@ struct BlazeAddParameterView: View { .frame(width: Layout.keyWidth, alignment: .leading) TextField(Localization.keyLabel, text: $viewModel.key) } - .onChange(of: viewModel.key) { _ in + .onChange(of: viewModel.key) { _, _ in viewModel.validateInputs() } @@ -31,7 +31,7 @@ struct BlazeAddParameterView: View { .frame(width: Layout.keyWidth, alignment: .leading) TextField(Localization.valueLabel, text: $viewModel.value) } - .onChange(of: viewModel.value) { _ in + .onChange(of: viewModel.value) { _, _ in viewModel.validateInputs() } } footer: { diff --git a/WooCommerce/Classes/ViewRelated/Blaze/BlazeCampaignList/BlazeCampaignListView.swift b/WooCommerce/Classes/ViewRelated/Blaze/BlazeCampaignList/BlazeCampaignListView.swift index 792a9a9e970..590c916e940 100644 --- a/WooCommerce/Classes/ViewRelated/Blaze/BlazeCampaignList/BlazeCampaignListView.swift +++ b/WooCommerce/Classes/ViewRelated/Blaze/BlazeCampaignList/BlazeCampaignListView.swift @@ -155,7 +155,7 @@ struct BlazeCampaignListView: View { }) { url in detailView(url: url) } - .onChange(of: viewModel.shouldShowIntroView) { shouldShow in + .onChange(of: viewModel.shouldShowIntroView) { _, shouldShow in if shouldShow { onCreateCampaign(nil) viewModel.shouldShowIntroView = false diff --git a/WooCommerce/Classes/ViewRelated/Blaze/CampaignCreation/BlazeCampaignCreationForm.swift b/WooCommerce/Classes/ViewRelated/Blaze/CampaignCreation/BlazeCampaignCreationForm.swift index 4526536f905..2c11c3290a8 100644 --- a/WooCommerce/Classes/ViewRelated/Blaze/CampaignCreation/BlazeCampaignCreationForm.swift +++ b/WooCommerce/Classes/ViewRelated/Blaze/CampaignCreation/BlazeCampaignCreationForm.swift @@ -222,7 +222,7 @@ struct BlazeCampaignCreationForm: View { isShowingCampaignObjectivePicker = false } } - .onChange(of: viewModel.error) { newValue in + .onChange(of: viewModel.error) { _, newValue in isShowingAISuggestionsErrorAlert = newValue == .failedToLoadAISuggestions } .alert(Localization.AISuggestionsErrorAlert.fetchingAISuggestions, isPresented: $isShowingAISuggestionsErrorAlert) { From 3569d410b7a7d9abf53f3ffb880575fd50a36a98 Mon Sep 17 00:00:00 2001 From: iamgabrielma Date: Thu, 4 Sep 2025 16:04:22 +0700 Subject: [PATCH 2/5] onchange updates to auth --- .../Jetpack Setup/Native Jetpack Setup/JetpackSetupView.swift | 2 +- .../ViewRelated/Authentication/AccountCreationForm.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/WooCommerce/Classes/Authentication/Jetpack Setup/Native Jetpack Setup/JetpackSetupView.swift b/WooCommerce/Classes/Authentication/Jetpack Setup/Native Jetpack Setup/JetpackSetupView.swift index c268174ae8d..20e8677448a 100644 --- a/WooCommerce/Classes/Authentication/Jetpack Setup/Native Jetpack Setup/JetpackSetupView.swift +++ b/WooCommerce/Classes/Authentication/Jetpack Setup/Native Jetpack Setup/JetpackSetupView.swift @@ -288,7 +288,7 @@ struct JetpackSetupView: View { .renderedIf(viewModel.setupFailed) }) .padding() - .onChange(of: viewModel.shouldPresentWebView) { shouldPresent in + .onChange(of: viewModel.shouldPresentWebView) { _, shouldPresent in if shouldPresent { webViewPresentationHandler() } diff --git a/WooCommerce/Classes/ViewRelated/Authentication/AccountCreationForm.swift b/WooCommerce/Classes/ViewRelated/Authentication/AccountCreationForm.swift index 76f9e189738..f3b5fe3642e 100644 --- a/WooCommerce/Classes/ViewRelated/Authentication/AccountCreationForm.swift +++ b/WooCommerce/Classes/ViewRelated/Authentication/AccountCreationForm.swift @@ -125,7 +125,7 @@ struct AccountCreationForm: View { } .background(Color(uiColor: .systemBackground)) } - .onChange(of: viewModel.shouldTransitionToPasswordField) { shouldTransition in + .onChange(of: viewModel.shouldTransitionToPasswordField) { _, shouldTransition in if shouldTransition { withAnimation { viewModel.transitionToPasswordField() From ff921a5b414d3dba4ec02785919a7c4296985cc9 Mon Sep 17 00:00:00 2001 From: iamgabrielma Date: Thu, 4 Sep 2025 16:04:51 +0700 Subject: [PATCH 3/5] onchange updates to shipping and product --- .../WooAddCustomPackageView.swift | 4 ++-- .../WooShippingAddresses/WooShippingEditAddressView.swift | 4 ++-- .../AddProductWithAI/Preview/ProductDetailPreviewView.swift | 2 +- .../StartingInfo/ProductCreationAIStartingInfoView.swift | 4 ++-- .../ProductCreationAIPromptProgressBar.swift | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/WooCommerce/Classes/ViewRelated/Orders/Order Details/Shipping Labels/WooShipping Create Shipping Labels/WooShipping Package and Rate Selection/WooAddCustomPackageView.swift b/WooCommerce/Classes/ViewRelated/Orders/Order Details/Shipping Labels/WooShipping Create Shipping Labels/WooShipping Package and Rate Selection/WooAddCustomPackageView.swift index 295aa2b4ab5..819387bccfb 100644 --- a/WooCommerce/Classes/ViewRelated/Orders/Order Details/Shipping Labels/WooShipping Create Shipping Labels/WooShipping Package and Rate Selection/WooAddCustomPackageView.swift +++ b/WooCommerce/Classes/ViewRelated/Orders/Order Details/Shipping Labels/WooShipping Create Shipping Labels/WooShipping Package and Rate Selection/WooAddCustomPackageView.swift @@ -149,10 +149,10 @@ struct WooAddCustomPackageView: View { .padding(.horizontal) .frame(minHeight: geometry.size.height) .frame(width: geometry.size.width) - .onChange(of: viewModel.showSaveTemplate) { newValue in + .onChange(of: viewModel.showSaveTemplate) { _, newValue in packageTemplateNameFieldFocused = newValue } - .onChange(of: packageTemplateNameFieldFocused) { focused in + .onChange(of: packageTemplateNameFieldFocused) { _, focused in if focused { // More info about why small delay is added: // - https://github.com/woocommerce/woocommerce-ios/pull/14086#discussion_r1806036901 diff --git a/WooCommerce/Classes/ViewRelated/Orders/Order Details/Shipping Labels/WooShipping Create Shipping Labels/WooShippingAddresses/WooShippingEditAddressView.swift b/WooCommerce/Classes/ViewRelated/Orders/Order Details/Shipping Labels/WooShipping Create Shipping Labels/WooShippingAddresses/WooShippingEditAddressView.swift index 7f5fca69fd0..011cd6d7592 100644 --- a/WooCommerce/Classes/ViewRelated/Orders/Order Details/Shipping Labels/WooShipping Create Shipping Labels/WooShippingAddresses/WooShippingEditAddressView.swift +++ b/WooCommerce/Classes/ViewRelated/Orders/Order Details/Shipping Labels/WooShipping Create Shipping Labels/WooShippingAddresses/WooShippingEditAddressView.swift @@ -85,7 +85,7 @@ struct WooShippingEditAddressView: View { } } .padding() - .onChange(of: focusedField) { newField in + .onChange(of: focusedField) { _, newField in if let previousFocusedField { viewModel.validate(previousFocusedField) } @@ -262,7 +262,7 @@ struct WooShippingEditAddressView: View { TextField(Localization.title(for: field.type), text: $field.value, prompt: Text(field.required ? "" : Localization.optional)) .keyboardType(keyboardType) .focused($focused, equals: field.type) - .onChange(of: field.value) { _ in + .onChange(of: field.value) { field.clearError() } .padding() diff --git a/WooCommerce/Classes/ViewRelated/Products/Add Product/AddProductWithAI/Preview/ProductDetailPreviewView.swift b/WooCommerce/Classes/ViewRelated/Products/Add Product/AddProductWithAI/Preview/ProductDetailPreviewView.swift index 652d5dec3a7..e425571280f 100644 --- a/WooCommerce/Classes/ViewRelated/Products/Add Product/AddProductWithAI/Preview/ProductDetailPreviewView.swift +++ b/WooCommerce/Classes/ViewRelated/Products/Add Product/AddProductWithAI/Preview/ProductDetailPreviewView.swift @@ -134,7 +134,7 @@ struct ProductDetailPreviewView: View { .onDisappear { viewModel.onViewDisappear() } - .onChange(of: viewModel.errorState) { newValue in + .onChange(of: viewModel.errorState) { _, newValue in isShowingErrorAlert = newValue != .none } .alert(viewModel.errorState.errorMessage, isPresented: $isShowingErrorAlert) { diff --git a/WooCommerce/Classes/ViewRelated/Products/Add Product/AddProductWithAI/StartingInfo/ProductCreationAIStartingInfoView.swift b/WooCommerce/Classes/ViewRelated/Products/Add Product/AddProductWithAI/StartingInfo/ProductCreationAIStartingInfoView.swift index 75cb7f0a4a9..244becf03e1 100644 --- a/WooCommerce/Classes/ViewRelated/Products/Add Product/AddProductWithAI/StartingInfo/ProductCreationAIStartingInfoView.swift +++ b/WooCommerce/Classes/ViewRelated/Products/Add Product/AddProductWithAI/StartingInfo/ProductCreationAIStartingInfoView.swift @@ -102,11 +102,11 @@ private extension ProductCreationAIStartingInfoView { .padding(insets: Layout.messageContentInsets) .focused($editorIsFocused) // Scrolls to the "TextField" view with a smooth animation while typing. - .onChange(of: viewModel.features) { _ in + .onChange(of: viewModel.features) { _, _ in scrollToTextField(using: proxy) } // Scrolls to the "TextField" view with a smooth animation when the editor is focused in a small screen. - .onChange(of: editorIsFocused) { isFocused in + .onChange(of: editorIsFocused) { _, isFocused in if isFocused { scrollToTextField(using: proxy) } diff --git a/WooCommerce/Classes/ViewRelated/Products/Add Product/AddProductWithAI/StartingInfo/PromptProgressBar/ProductCreationAIPromptProgressBar.swift b/WooCommerce/Classes/ViewRelated/Products/Add Product/AddProductWithAI/StartingInfo/PromptProgressBar/ProductCreationAIPromptProgressBar.swift index 44e67363467..fbbe2ccc321 100644 --- a/WooCommerce/Classes/ViewRelated/Products/Add Product/AddProductWithAI/StartingInfo/PromptProgressBar/ProductCreationAIPromptProgressBar.swift +++ b/WooCommerce/Classes/ViewRelated/Products/Add Product/AddProductWithAI/StartingInfo/PromptProgressBar/ProductCreationAIPromptProgressBar.swift @@ -29,9 +29,9 @@ struct ProductCreationAIPromptProgressBar: View { .onAppear(perform: { viewModel.updateText(to: text) }) - .onChange(of: text, perform: { newText in + .onChange(of: text) { _, newText in viewModel.updateText(to: newText) - }) + } } } From 359363bfff79e2ea22f84cab52571ffa4e772161 Mon Sep 17 00:00:00 2001 From: iamgabrielma Date: Thu, 4 Sep 2025 16:05:02 +0700 Subject: [PATCH 4/5] onchange updates remaining --- .../Classes/View Modifiers/View+Measurements.swift | 8 ++++---- .../SwiftUI Components/FormattableAmountTextField.swift | 4 +++- .../ReusableViews/SwiftUI Components/TopTabView.swift | 8 ++++---- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/WooCommerce/Classes/View Modifiers/View+Measurements.swift b/WooCommerce/Classes/View Modifiers/View+Measurements.swift index b1d7cbeec99..26ff725ac94 100644 --- a/WooCommerce/Classes/View Modifiers/View+Measurements.swift +++ b/WooCommerce/Classes/View Modifiers/View+Measurements.swift @@ -14,7 +14,7 @@ extension View { .onAppear { callback(proxy.size.height) } - .onChange(of: proxy.size.height) { newHeight in + .onChange(of: proxy.size.height) { _, newHeight in callback(newHeight) } } @@ -32,7 +32,7 @@ extension View { .onAppear { callback(proxy.size.width) } - .onChange(of: proxy.size.width) { newWidth in + .onChange(of: proxy.size.width) { _, newWidth in callback(newWidth) } } @@ -48,10 +48,10 @@ extension View { .onAppear { callback(proxy.frame(in: .global)) } - .onChange(of: proxy.size.height) { newHeight in + .onChange(of: proxy.size.height) { _, newHeight in callback(proxy.frame(in: .global)) } - .onChange(of: proxy.frame(in: .global)) { newHeight in + .onChange(of: proxy.frame(in: .global)) { _, newHeight in callback(proxy.frame(in: .global)) } } diff --git a/WooCommerce/Classes/ViewRelated/ReusableViews/SwiftUI Components/FormattableAmountTextField.swift b/WooCommerce/Classes/ViewRelated/ReusableViews/SwiftUI Components/FormattableAmountTextField.swift index 8fa0b923045..720fb37680a 100644 --- a/WooCommerce/Classes/ViewRelated/ReusableViews/SwiftUI Components/FormattableAmountTextField.swift +++ b/WooCommerce/Classes/ViewRelated/ReusableViews/SwiftUI Components/FormattableAmountTextField.swift @@ -18,7 +18,9 @@ struct FormattableAmountTextField: View { ZStack(alignment: .center) { // Hidden input text field TextField("", text: $viewModel.textFieldAmountText) - .onChange(of: viewModel.textFieldAmountText, perform: viewModel.updateAmount) + .onChange(of: viewModel.textFieldAmountText) { _, newValue in + viewModel.updateAmount(newValue) + } .focused() .focused($focusAmountInput) .keyboardType(viewModel.allowNegativeNumber ? .numbersAndPunctuation : .decimalPad) diff --git a/WooCommerce/Classes/ViewRelated/ReusableViews/SwiftUI Components/TopTabView.swift b/WooCommerce/Classes/ViewRelated/ReusableViews/SwiftUI Components/TopTabView.swift index c6d2a85ce1e..c5f82637d38 100644 --- a/WooCommerce/Classes/ViewRelated/ReusableViews/SwiftUI Components/TopTabView.swift +++ b/WooCommerce/Classes/ViewRelated/ReusableViews/SwiftUI Components/TopTabView.swift @@ -172,7 +172,7 @@ struct TopTabView: View { scrollFocusTab(in: scrollViewProxy, at: index) } } - .onChange(of: geometry.size) { newSize in + .onChange(of: geometry.size) { _, newSize in /// Support dynamic type size change if index < tabWidths.count { tabWidths[index] = newSize.width @@ -194,11 +194,11 @@ struct TopTabView: View { .offset(x: underlineOffset), alignment: .bottomLeading ) - .onChange(of: selectedTab, perform: { newSelectedTab in + .onChange(of: selectedTab) { _, newSelectedTab in withAnimation { selectTab(in: scrollViewProxy, at: newSelectedTab) } - }) + } .coordinateSpace(name: Constants.tabsHorizontalStackNameSpace) } .padding(.horizontal, tabsContainerHorizontalPadding) @@ -235,7 +235,7 @@ struct TopTabView: View { .onAppear { contentSize = contentGeometry.size } - .onChange(of: contentGeometry.size) { newSize in + .onChange(of: contentGeometry.size) { _, newSize in contentSize = newSize } }) From 590981710918e33178c252b8c8e91eeec363b923 Mon Sep 17 00:00:00 2001 From: iamgabrielma Date: Thu, 4 Sep 2025 16:09:12 +0700 Subject: [PATCH 5/5] update release notes --- RELEASE-NOTES.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt index 97337d051fe..893b917111f 100644 --- a/RELEASE-NOTES.txt +++ b/RELEASE-NOTES.txt @@ -5,6 +5,7 @@ ----- - [*] POS: Enhanced cash payment experience with pre-filled amounts. [https://github.com/woocommerce/woocommerce-ios/pull/16058] - [*] POS: Point of Sale settings are now accessible in POS mode [https://github.com/woocommerce/woocommerce-ios/pull/16067] +- [internal] Address deprecated view modifiers usage following iOS17 API updates [https://github.com/woocommerce/woocommerce-ios/pull/16080] 23.1 ----- @@ -12,7 +13,6 @@ - [***] Increased app's minimum deployment target to iOS17 [https://github.com/woocommerce/woocommerce-ios/pull/16003] - [*] Jetpack setup: Native experience for the connection step [https://github.com/woocommerce/woocommerce-ios/pull/15983] - [*] 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] -- [internal] Address deprecated view modifiers usage following iOS17 API updates [https://github.com/woocommerce/woocommerce-ios/pull/16002] - [*] Add "POS" label in Most recent orders in My store dashboard [https://github.com/woocommerce/woocommerce-ios/pull/16006] - [*] Order details: Always show shipping labels section if order is eligible for label creation. [https://github.com/woocommerce/woocommerce-ios/pull/16010] - [*] Order details: Remove print buttons from shipment details [https://github.com/woocommerce/woocommerce-ios/pull/16012]