From 86d2f7d76b1b8d22b07c87bce86c6a88947e297f Mon Sep 17 00:00:00 2001 From: Kieran Osgood Date: Wed, 13 May 2026 11:34:44 +0100 Subject: [PATCH] Align PassKit protocol abstractions with Swift 6 --- .../ApplePayAuthorizationDelegate+Controller.swift | 4 ++-- .../ApplePayAuthorizationDelegate.swift | 9 +++++---- .../Wallets/ApplePay/Data/PassKitFactory.swift | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Wallets/ApplePay/ApplePayAuthorizationDelegate/ApplePayAuthorizationDelegate+Controller.swift b/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Wallets/ApplePay/ApplePayAuthorizationDelegate/ApplePayAuthorizationDelegate+Controller.swift index 598bd3b9..a3a1d19c 100644 --- a/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Wallets/ApplePay/ApplePayAuthorizationDelegate/ApplePayAuthorizationDelegate+Controller.swift +++ b/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Wallets/ApplePay/ApplePayAuthorizationDelegate/ApplePayAuthorizationDelegate+Controller.swift @@ -21,11 +21,11 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -import PassKit +@preconcurrency import PassKit import ShopifyCheckoutKit @available(iOS 16.0, *) -extension ApplePayAuthorizationDelegate: PKPaymentAuthorizationControllerDelegate { +extension ApplePayAuthorizationDelegate: @preconcurrency PKPaymentAuthorizationControllerDelegate { /// Triggers on payment sheet presentation, and if user changes shipping address /// /// Only triggered if the PKPaymentRequest has `requiredShippingContactFields` set diff --git a/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Wallets/ApplePay/ApplePayAuthorizationDelegate/ApplePayAuthorizationDelegate.swift b/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Wallets/ApplePay/ApplePayAuthorizationDelegate/ApplePayAuthorizationDelegate.swift index 0d6c9334..542bdf74 100644 --- a/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Wallets/ApplePay/ApplePayAuthorizationDelegate/ApplePayAuthorizationDelegate.swift +++ b/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Wallets/ApplePay/ApplePayAuthorizationDelegate/ApplePayAuthorizationDelegate.swift @@ -22,23 +22,24 @@ */ import Foundation -import PassKit +@preconcurrency import PassKit import ShopifyCheckoutKit // MARK: - PaymentAuthorizationController Protocol /// Protocol to abstract PKPaymentAuthorizationController for testing @available(iOS 16.0, *) +@MainActor protocol PaymentAuthorizationController { - var delegate: PKPaymentAuthorizationControllerDelegate? { get set } + var delegate: (any PKPaymentAuthorizationControllerDelegate)? { get set } func present() async -> Bool - func dismiss(completion: (() -> Void)?) + func dismiss(completion: (@Sendable () -> Void)?) } extension PKPaymentAuthorizationController: PaymentAuthorizationController {} @available(iOS 16.0, *) -typealias PKAuthorizationControllerFactory = (PKPaymentRequest) -> PaymentAuthorizationController +typealias PKAuthorizationControllerFactory = @MainActor (PKPaymentRequest) -> any PaymentAuthorizationController @available(iOS 16.0, *) @MainActor diff --git a/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Wallets/ApplePay/Data/PassKitFactory.swift b/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Wallets/ApplePay/Data/PassKitFactory.swift index 612f4034..9f586201 100644 --- a/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Wallets/ApplePay/Data/PassKitFactory.swift +++ b/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Wallets/ApplePay/Data/PassKitFactory.swift @@ -24,7 +24,7 @@ import PassKit @available(iOS 16.0, *) -class PassKitFactory { +final class PassKitFactory: Sendable { static let shared = PassKitFactory() private struct DeliveryOptionWithGroupType {