diff --git a/platforms/swift/.swiftformat b/platforms/swift/.swiftformat index abb96b6a..7511a170 100644 --- a/platforms/swift/.swiftformat +++ b/platforms/swift/.swiftformat @@ -6,7 +6,7 @@ --allman false --semicolons inline --trimwhitespace always ---disable redundantReturn,hoistAwait,preferKeyPath,redundantInternal,redundantPublic +--disable redundantReturn,hoistAwait,preferKeyPath,redundantInternal,redundantPublic,duplicateImports --swiftversion 5.7.1 --extensionacl on-declarations --exclude Sources/ShopifyCheckoutKit/Models.swift diff --git a/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/GraphQLClient/GraphQLRequest/GraphQLRequest+Directives.swift b/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/GraphQLClient/GraphQLRequest/GraphQLRequest+Directives.swift index ce5037cf..7b7058d5 100644 --- a/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/GraphQLClient/GraphQLRequest/GraphQLRequest+Directives.swift +++ b/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/GraphQLClient/GraphQLRequest/GraphQLRequest+Directives.swift @@ -26,7 +26,7 @@ import Foundation /// The country and language context for the API requests /// see: https://shopify.dev/changelog/storefront-api-incontext-directive-supports-languages @available(iOS 16.0, *) -struct InContextDirective: Sendable { +struct InContextDirective { let countryCode: CountryCode let languageCode: ShopifyLanguageCode diff --git a/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/GraphQLClient/GraphQLResponse.swift b/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/GraphQLClient/GraphQLResponse.swift index 46dfb661..d44b0083 100644 --- a/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/GraphQLClient/GraphQLResponse.swift +++ b/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/GraphQLClient/GraphQLResponse.swift @@ -22,7 +22,7 @@ */ /// GraphQL response structure -struct GraphQLResponse: Decodable, Sendable { +struct GraphQLResponse: Decodable { let data: T? let errors: [GraphQLResponseError]? let extensions: [String: AnyCodable]? @@ -34,18 +34,18 @@ struct GraphQLResponse: Decodable, Sendable { } /// GraphQL error from response -struct GraphQLResponseError: Decodable, Error, Sendable { +struct GraphQLResponseError: Decodable, Error { let message: String let path: [String]? let locations: [Location]? let extensions: Extensions? - struct Location: Decodable, Sendable { + struct Location: Decodable { let line: Int let column: Int } - struct Extensions: Decodable, Sendable { + struct Extensions: Decodable { let code: String? let field: [String]? let cost: Int? diff --git a/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/GraphQLClient/GraphQLScalars.swift b/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/GraphQLClient/GraphQLScalars.swift index 1d324297..3d31e99c 100644 --- a/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/GraphQLClient/GraphQLScalars.swift +++ b/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/GraphQLClient/GraphQLScalars.swift @@ -26,7 +26,7 @@ import Foundation /// Custom scalar types for the Storefront API enum GraphQLScalars { /// Represents a globally unique identifier (GID) in the Storefront API - struct ID: Codable, Sendable, Hashable, CustomStringConvertible { + struct ID: Codable, Hashable, CustomStringConvertible { let rawValue: String init(_ rawValue: String) { @@ -54,13 +54,13 @@ enum GraphQLScalars { } /// Represents a monetary value with a decimal amount and currency code - struct Money: Codable, Sendable, Hashable { + struct Money: Codable, Hashable { let amount: Decimal let currencyCode: String } /// Represents an ISO 8601 encoded date-time string - struct DateTime: Codable, Sendable, Hashable { + struct DateTime: Codable, Hashable { let date: Date init(_ date: Date) { @@ -99,7 +99,7 @@ enum GraphQLScalars { } /// Represents an absolute URL - struct URL: Codable, Sendable, Hashable { + struct URL: Codable, Hashable { let url: Foundation.URL init(_ url: Foundation.URL) { @@ -130,7 +130,7 @@ enum GraphQLScalars { } /// Represents HTML content - struct HTML: Codable, Sendable, Hashable { + struct HTML: Codable, Hashable { let rawValue: String init(_ rawValue: String) { @@ -150,7 +150,7 @@ enum GraphQLScalars { } /// ISO 4217 currency codes -enum CurrencyCode: String, Codable, Sendable, CaseIterable { +enum CurrencyCode: String, Codable, CaseIterable { case aed = "AED" case afn = "AFN" case all = "ALL" @@ -309,7 +309,7 @@ enum CurrencyCode: String, Codable, Sendable, CaseIterable { case zmw = "ZMW" } -enum LanguageCode: String, CaseIterable, Codable, Sendable { +enum LanguageCode: String, CaseIterable, Codable { /// Afrikaans case AF /// Akan @@ -604,7 +604,7 @@ enum LanguageCode: String, CaseIterable, Codable, Sendable { /// If a territory doesn't have a country code value in the `CountryCode` enum, then it might be considered a subdivision /// of another country. For example, the territories associated with Spain are represented by the country code `ES`, /// and the territories associated with the United States of America are represented by the country code `US`. -enum CountryCode: String, CaseIterable, Codable, Sendable { +enum CountryCode: String, CaseIterable, Codable { /// Afghanistan case AF /// Ă…land Islands diff --git a/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/GraphQLClient/GraphQLTypes.swift b/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/GraphQLClient/GraphQLTypes.swift index 979cdc7b..ea37cf36 100644 --- a/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/GraphQLClient/GraphQLTypes.swift +++ b/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/GraphQLClient/GraphQLTypes.swift @@ -24,7 +24,7 @@ import Foundation /// GraphQL client errors -enum GraphQLError: LocalizedError, Sendable { +enum GraphQLError: LocalizedError { case networkError(String) case httpError(statusCode: Int, data: Data) case decodingError(Error) diff --git a/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/StorefrontAPI/StorefrontAPI+Mutations.swift b/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/StorefrontAPI/StorefrontAPI+Mutations.swift index fe941662..4006cc10 100644 --- a/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/StorefrontAPI/StorefrontAPI+Mutations.swift +++ b/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/StorefrontAPI/StorefrontAPI+Mutations.swift @@ -75,7 +75,7 @@ extension StorefrontAPI { return cart } - struct CartBuyerIdentityUpdateInput: Codable, Sendable { + struct CartBuyerIdentityUpdateInput: Codable { var email: String? var phoneNumber: String? var customerAccessToken: String? diff --git a/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/StorefrontAPI/StorefrontAPI+Types.swift b/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/StorefrontAPI/StorefrontAPI+Types.swift index fe9a30d1..48b93395 100644 --- a/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/StorefrontAPI/StorefrontAPI+Types.swift +++ b/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/StorefrontAPI/StorefrontAPI+Types.swift @@ -41,7 +41,7 @@ extension StorefrontAPI { } /// Represents a cart in the Storefront API - struct Cart: Codable, Sendable { + struct Cart: Codable { let id: Types.ID let checkoutUrl: GraphQLScalars.URL let totalQuantity: Int @@ -55,31 +55,31 @@ extension StorefrontAPI { } /// Cart discount code - struct CartDiscountCode: Codable, Sendable { + struct CartDiscountCode: Codable { let code: String let applicable: Bool } /// Cart buyer identity - struct CartBuyerIdentity: Codable, Sendable { + struct CartBuyerIdentity: Codable { let email: String? let phone: String? let customer: CartCustomer? } /// Cart customer information - struct CartCustomer: Codable, Sendable { + struct CartCustomer: Codable { let email: String? let phone: String? } /// Cart delivery information - struct CartDelivery: Codable, Sendable { + struct CartDelivery: Codable { let addresses: [CartSelectableAddress] } /// Cart selectable address - struct CartSelectableAddress: Codable, Sendable { + struct CartSelectableAddress: Codable { let id: Types.ID let selected: Bool let address: CartDeliveryAddress? @@ -88,7 +88,7 @@ extension StorefrontAPI { /// Cart delivery address /// Note: This is a GraphQL response type that uses countryCode/provinceCode /// instead of country/province like the input Address type - struct CartDeliveryAddress: Codable, Sendable { + struct CartDeliveryAddress: Codable { let address1: String? let address2: String? let city: String? @@ -101,7 +101,7 @@ extension StorefrontAPI { } /// Cart cost breakdown - struct CartCost: Codable, Sendable { + struct CartCost: Codable { let totalAmount: MoneyV2 let subtotalAmount: MoneyV2? let totalTaxAmount: MoneyV2? @@ -109,7 +109,7 @@ extension StorefrontAPI { } /// Money representation - struct MoneyV2: Codable, Sendable { + struct MoneyV2: Codable { let amount: Decimal let currencyCode: String @@ -155,12 +155,12 @@ extension StorefrontAPI { // MARK: - Cart Lines /// Connection type for cart lines - struct BaseCartLineConnection: Codable, Sendable { + struct BaseCartLineConnection: Codable { let nodes: [BaseCartLine] } /// Cart discount allocation - enum CartDiscountAllocation: Codable, Sendable { + enum CartDiscountAllocation: Codable { case automatic(CartAutomaticDiscountAllocation) case code(CartCodeDiscountAllocation) case custom(CartCustomDiscountAllocation) @@ -169,7 +169,7 @@ extension StorefrontAPI { case __typename } - private enum TypeName: String, Codable, Sendable { + private enum TypeName: String, Codable { case cartAutomaticDiscountAllocation = "CartAutomaticDiscountAllocation" case cartCodeDiscountAllocation = "CartCodeDiscountAllocation" case cartCustomDiscountAllocation = "CartCustomDiscountAllocation" @@ -205,14 +205,14 @@ extension StorefrontAPI { } /// Automatic discount allocation - struct CartAutomaticDiscountAllocation: Codable, Sendable { + struct CartAutomaticDiscountAllocation: Codable { let discountApplication: CartDiscountApplication let discountedAmount: MoneyV2 let targetType: DiscountApplicationTargetType } /// Code discount allocation - struct CartCodeDiscountAllocation: Codable, Sendable { + struct CartCodeDiscountAllocation: Codable { let code: String let discountApplication: CartDiscountApplication let discountedAmount: MoneyV2 @@ -220,34 +220,34 @@ extension StorefrontAPI { } /// Custom discount allocation - struct CartCustomDiscountAllocation: Codable, Sendable { + struct CartCustomDiscountAllocation: Codable { let discountApplication: CartDiscountApplication let discountedAmount: MoneyV2 let targetType: DiscountApplicationTargetType } /// Cart discount application - struct CartDiscountApplication: Codable, Sendable { + struct CartDiscountApplication: Codable { let targetSelection: DiscountApplicationTargetSelection let targetType: DiscountApplicationTargetType let value: PricingValue } /// Discount application target selection - enum DiscountApplicationTargetSelection: String, Codable, Sendable { + enum DiscountApplicationTargetSelection: String, Codable { case all = "ALL" case entitled = "ENTITLED" case explicit = "EXPLICIT" } /// Discount application target type - enum DiscountApplicationTargetType: String, Codable, Sendable { + enum DiscountApplicationTargetType: String, Codable { case lineItem = "LINE_ITEM" case shippingLine = "SHIPPING_LINE" } /// Pricing value (union type for percentage or fixed amount) - enum PricingValue: Codable, Sendable { + enum PricingValue: Codable { case percentage(PricingPercentageValue) case fixedAmount(MoneyV2) @@ -255,7 +255,7 @@ extension StorefrontAPI { case __typename } - private enum TypeName: String, Codable, Sendable { + private enum TypeName: String, Codable { case pricingPercentageValue = "PricingPercentageValue" case moneyV2 = "MoneyV2" } @@ -285,12 +285,12 @@ extension StorefrontAPI { } /// Pricing percentage value - struct PricingPercentageValue: Codable, Sendable { + struct PricingPercentageValue: Codable { let percentage: Double } /// Base cart line - struct BaseCartLine: Codable, Sendable { + struct BaseCartLine: Codable { let id: Types.ID let quantity: Int let merchandise: ProductVariant? @@ -299,7 +299,7 @@ extension StorefrontAPI { } /// Cart line cost - struct CartLineCost: Codable, Sendable { + struct CartLineCost: Codable { let totalAmount: MoneyV2 let subtotalAmount: MoneyV2 } @@ -307,7 +307,7 @@ extension StorefrontAPI { // MARK: - Product Models /// Product variant - struct ProductVariant: Codable, Sendable { + struct ProductVariant: Codable { let id: Types.ID let title: String let price: MoneyV2 @@ -316,7 +316,7 @@ extension StorefrontAPI { } /// Product - struct Product: Codable, Sendable { + struct Product: Codable { let id: Types.ID? let title: String let vendor: String? @@ -325,24 +325,24 @@ extension StorefrontAPI { } /// Product variant connection - struct ProductVariantConnection: Codable, Sendable { + struct ProductVariantConnection: Codable { let nodes: [ProductVariant] } /// Product connection - struct ProductConnection: Codable, Sendable { + struct ProductConnection: Codable { let nodes: [Product] } /// Image - struct Image: Codable, Sendable { + struct Image: Codable { let url: GraphQLScalars.URL } // MARK: - Shop /// Shop information - struct Shop: Codable, Sendable { + struct Shop: Codable { let name: String let description: String? let primaryDomain: ShopDomain @@ -352,21 +352,21 @@ extension StorefrontAPI { } /// Shop domain - struct ShopDomain: Codable, Sendable { + struct ShopDomain: Codable { let host: String let sslEnabled: Bool let url: GraphQLScalars.URL } /// Shop payment settings - struct ShopPaymentSettings: Codable, Sendable { + struct ShopPaymentSettings: Codable { let supportedDigitalWallets: [String] let acceptedCardBrands: [CardBrand] let countryCode: String } /// Card brands supported by Shopify's payment system - enum CardBrand: String, Codable, Sendable, CaseIterable { + enum CardBrand: String, Codable, CaseIterable { case americanExpress = "AMERICAN_EXPRESS" case dinersClub = "DINERS_CLUB" case discover = "DISCOVER" @@ -378,12 +378,12 @@ extension StorefrontAPI { // MARK: - Delivery Groups /// Connection type for delivery groups - struct CartDeliveryGroupConnection: Codable, Sendable { + struct CartDeliveryGroupConnection: Codable { let nodes: [CartDeliveryGroup] } /// Cart delivery group - struct CartDeliveryGroup: Codable, Sendable { + struct CartDeliveryGroup: Codable { let id: Types.ID let groupType: CartDeliveryGroupType let deliveryOptions: [CartDeliveryOption] @@ -391,13 +391,13 @@ extension StorefrontAPI { } /// Cart delivery group type - enum CartDeliveryGroupType: String, Codable, Sendable { + enum CartDeliveryGroupType: String, Codable { case oneTimePurchase = "ONE_TIME_PURCHASE" case subscription = "SUBSCRIPTION" } /// Cart delivery option - struct CartDeliveryOption: Codable, Sendable { + struct CartDeliveryOption: Codable { let handle: String let title: String let code: String? @@ -407,7 +407,7 @@ extension StorefrontAPI { } /// Delivery method type - enum DeliveryMethodType: String, Codable, Sendable { + enum DeliveryMethodType: String, Codable { case local = "LOCAL" case none = "NONE" case pickupPoint = "PICKUP_POINT" @@ -419,14 +419,14 @@ extension StorefrontAPI { // MARK: - User Errors /// Cart user error - struct CartUserError: Codable, Sendable, Error { + struct CartUserError: Codable, Error { let code: CartErrorCode? let message: String let field: [String]? } /// Cart error codes - enum CartErrorCode: String, Codable, Sendable { + enum CartErrorCode: String, Codable { case addressFieldContainsEmojis = "ADDRESS_FIELD_CONTAINS_EMOJIS" case addressFieldContainsHtmlTags = "ADDRESS_FIELD_CONTAINS_HTML_TAGS" case addressFieldContainsUrl = "ADDRESS_FIELD_CONTAINS_URL" @@ -499,7 +499,7 @@ extension StorefrontAPI { // MARK: - Mutation Payloads - struct CartPayload: Codable, Sendable { + struct CartPayload: Codable { let cart: Cart? let userErrors: [CartUserError] } @@ -526,13 +526,13 @@ extension StorefrontAPI { typealias CartRemovePersonalDataPayload = CartPayload /// Cart prepare for completion payload - struct CartPrepareForCompletionPayload: Codable, Sendable { + struct CartPrepareForCompletionPayload: Codable { let result: CartPrepareForCompletionResult? let userErrors: [CartUserError] } /// Cart prepare for completion result (union type) - enum CartPrepareForCompletionResult: Codable, Sendable { + enum CartPrepareForCompletionResult: Codable { case ready(CartStatusReady) case throttled(CartThrottled) case notReady(CartStatusNotReady) @@ -541,7 +541,7 @@ extension StorefrontAPI { case __typename } - private enum TypeName: String, Codable, Sendable { + private enum TypeName: String, Codable { case cartStatusReady = "CartStatusReady" case cartThrottled = "CartThrottled" case cartStatusNotReady = "CartStatusNotReady" @@ -577,30 +577,30 @@ extension StorefrontAPI { } /// Cart status ready - struct CartStatusReady: Codable, Sendable { + struct CartStatusReady: Codable { let cart: Cart? let checkoutURL: GraphQLScalars.URL? } /// Cart throttled - struct CartThrottled: Codable, Sendable { + struct CartThrottled: Codable { let pollAfter: GraphQLScalars.DateTime } /// Cart status not ready - struct CartStatusNotReady: Codable, Sendable { + struct CartStatusNotReady: Codable { let cart: Cart? let errors: [CartCompletionError] } /// Cart submit for completion payload - struct CartSubmitForCompletionPayload: Codable, Sendable { + struct CartSubmitForCompletionPayload: Codable { let result: CartSubmitForCompletionResult? let userErrors: [CartUserError] } /// Cart submit for completion result (union type) - enum CartSubmitForCompletionResult: Codable, Sendable { + enum CartSubmitForCompletionResult: Codable { case success(SubmitSuccess) case failed(SubmitFailed) case alreadyAccepted(SubmitAlreadyAccepted) @@ -610,7 +610,7 @@ extension StorefrontAPI { case __typename } - private enum TypeName: String, Codable, Sendable { + private enum TypeName: String, Codable { case submitSuccess = "SubmitSuccess" case submitFailed = "SubmitFailed" case submitAlreadyAccepted = "SubmitAlreadyAccepted" @@ -652,28 +652,28 @@ extension StorefrontAPI { } /// Submit success - struct SubmitSuccess: Codable, Sendable { + struct SubmitSuccess: Codable { let redirectUrl: GraphQLScalars.URL } /// Submit failed - struct SubmitFailed: Codable, Sendable { + struct SubmitFailed: Codable { let checkoutUrl: GraphQLScalars.URL? let errors: [CartCompletionError] } /// Submit already accepted - struct SubmitAlreadyAccepted: Codable, Sendable { + struct SubmitAlreadyAccepted: Codable { let attemptId: String } /// Submit throttled - struct SubmitThrottled: Codable, Sendable { + struct SubmitThrottled: Codable { let pollAfter: GraphQLScalars.DateTime } /// Cart completion error (used by both cartPrepareForCompletion and cartSubmitForCompletion) - struct CartCompletionError: Codable, Sendable { + struct CartCompletionError: Codable { let code: CartCompletionErrorCode let rawCode: String let message: String @@ -697,7 +697,7 @@ extension StorefrontAPI { } /// Error codes for cart completion (shared by prepare and submit stages) - enum CartCompletionErrorCode: String, Codable, Sendable { + enum CartCompletionErrorCode: String, Codable { // Buyer identity errors case buyerIdentityEmailIsInvalid = "BUYER_IDENTITY_EMAIL_IS_INVALID" case buyerIdentityEmailRequired = "BUYER_IDENTITY_EMAIL_REQUIRED" @@ -826,24 +826,24 @@ extension StorefrontAPI { // MARK: - Query Response Wrappers /// Response wrapper for cart query - struct CartQueryResponse: Codable, Sendable { + struct CartQueryResponse: Codable { let cart: Cart? } /// Response wrapper for products query - struct ProductsQueryResponse: Codable, Sendable { + struct ProductsQueryResponse: Codable { let products: ProductConnection } /// Response wrapper for shop query - struct ShopQueryResponse: Codable, Sendable { + struct ShopQueryResponse: Codable { let shop: Shop } // MARK: - Input Types /// Unified address structure for input operations - struct Address: Sendable { + struct Address { let address1: String? let address2: String? let city: String? @@ -914,7 +914,7 @@ extension StorefrontAPI { typealias DeliveryAddress = Address /// Apple Pay payment data - struct ApplePayPayment: Sendable { + struct ApplePayPayment { let billingAddress: ApplePayBillingAddress let ephemeralPublicKey: String let publicKeyHash: String diff --git a/platforms/swift/Sources/ShopifyAcceleratedCheckouts/ShopifyAcceleratedCheckouts+Configuration.swift b/platforms/swift/Sources/ShopifyAcceleratedCheckouts/ShopifyAcceleratedCheckouts+Configuration.swift index f3b75864..2e606a6a 100644 --- a/platforms/swift/Sources/ShopifyAcceleratedCheckouts/ShopifyAcceleratedCheckouts+Configuration.swift +++ b/platforms/swift/Sources/ShopifyAcceleratedCheckouts/ShopifyAcceleratedCheckouts+Configuration.swift @@ -26,7 +26,7 @@ import SwiftUI @available(iOS 16.0, *) extension ShopifyAcceleratedCheckouts { - struct CustomerIdentity: Sendable { + struct CustomerIdentity { let email: String? let phoneNumber: String? let customerAccessToken: String? diff --git a/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Wallets/ApplePay/ApplePayViewController.swift b/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Wallets/ApplePay/ApplePayViewController.swift index a0c076b6..17459c5f 100644 --- a/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Wallets/ApplePay/ApplePayViewController.swift +++ b/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Wallets/ApplePay/ApplePayViewController.swift @@ -115,7 +115,7 @@ class ApplePayViewController: WalletController, PayController { ShopifyAcceleratedCheckouts.logger.error( "[startPayment] Failed to setup cart: \(error)" ) - self.onCheckoutFail?(.sdkError(underlying: error, recoverable: false)) + onCheckoutFail?(.sdkError(underlying: error, recoverable: false)) } do { diff --git a/platforms/swift/Sources/ShopifyCheckoutProtocol/Generated/Models.swift b/platforms/swift/Sources/ShopifyCheckoutProtocol/Generated/Models.swift index d595a271..4c034dea 100644 --- a/platforms/swift/Sources/ShopifyCheckoutProtocol/Generated/Models.swift +++ b/platforms/swift/Sources/ShopifyCheckoutProtocol/Generated/Models.swift @@ -7623,17 +7623,13 @@ func newJSONEncoder() -> JSONEncoder { // MARK: - Encode/decode helpers -public class JSONNull: Codable, Hashable { +public final class JSONNull: Codable, Hashable, Sendable { public static func == (_: JSONNull, _: JSONNull) -> Bool { return true } - public var hashValue: Int { - return 0 - } - - public func hash(into _: inout Hasher) { - // No-op + public func hash(into hasher: inout Hasher) { + hasher.combine(0) } public init() {} @@ -7671,7 +7667,7 @@ final class JSONCodingKey: CodingKey, Sendable { } } -public class JSONAny: Codable { +public final class JSONAny: Codable, @unchecked Sendable { public let value: Any static func decodingError(forCodingPath codingPath: [CodingKey]) -> DecodingError { diff --git a/platforms/swift/Tests/ShopifyAcceleratedCheckoutsTests/Internal/StorefrontAPI/StorefrontAPIMutationsTests.swift b/platforms/swift/Tests/ShopifyAcceleratedCheckoutsTests/Internal/StorefrontAPI/StorefrontAPIMutationsTests.swift index 7ee4a043..ba43a831 100644 --- a/platforms/swift/Tests/ShopifyAcceleratedCheckoutsTests/Internal/StorefrontAPI/StorefrontAPIMutationsTests.swift +++ b/platforms/swift/Tests/ShopifyAcceleratedCheckoutsTests/Internal/StorefrontAPI/StorefrontAPIMutationsTests.swift @@ -372,11 +372,11 @@ final class StorefrontAPIMutationsTests: XCTestCase { """ mockJSONResponse(json) - let customer = ShopifyAcceleratedCheckouts.CustomerIdentity( + let customer = try XCTUnwrap(ShopifyAcceleratedCheckouts.CustomerIdentity( email: "customer@example.com", phoneNumber: "+1234567890", customerAccessToken: "test-token-123" - )! + )) let variantId = GraphQLScalars.ID("gid://shopify/ProductVariant/1") let cart = try await storefrontAPI.cartCreate(with: [variantId], customer: customer) diff --git a/platforms/swift/Tests/ShopifyAcceleratedCheckoutsTests/Wallets/ApplePay/ApplePayIntegrationTests.swift b/platforms/swift/Tests/ShopifyAcceleratedCheckoutsTests/Wallets/ApplePay/ApplePayIntegrationTests.swift index 0000e308..840953ea 100644 --- a/platforms/swift/Tests/ShopifyAcceleratedCheckoutsTests/Wallets/ApplePay/ApplePayIntegrationTests.swift +++ b/platforms/swift/Tests/ShopifyAcceleratedCheckoutsTests/Wallets/ApplePay/ApplePayIntegrationTests.swift @@ -147,7 +147,7 @@ final class ApplePayIntegrationTests: XCTestCase { // The view should essentially be empty/minimal due to invariant case } - func testCallbackPersistenceAcrossViewUpdates() async { + func testCallbackPersistenceAcrossViewUpdates() { var failCount = 0 let failHandler = { (_: CheckoutError) in failCount += 1 diff --git a/protocol/scripts/generate_models.sh b/protocol/scripts/generate_models.sh index c8c1123e..79595d65 100755 --- a/protocol/scripts/generate_models.sh +++ b/protocol/scripts/generate_models.sh @@ -213,7 +213,6 @@ case "$LANG" in OUTPUT="${REPO_ROOT}/platforms/swift/Sources/ShopifyCheckoutProtocol/Generated/Models.swift" quicktype \ --lang swift \ - --swift-5-support \ --access-level public \ --sendable \ --src-lang schema \ @@ -233,7 +232,11 @@ case "$LANG" in sed -i '' -E \ -e 's/[[:<:]]Binding[[:>:]]/TokenBinding/g' \ -e 's/[[:<:]]ColorScheme[[:>:]]/EmbeddedColorScheme/g' \ + -e 's/^public class JSONNull: Codable, Hashable {/public final class JSONNull: Codable, Hashable, Sendable {/' \ + -e 's/^ public func hash\(into _: inout Hasher\) {/ public func hash(into hasher: inout Hasher) {/' \ + -e 's/^ \/\/ No-op$/ hasher.combine(0)/' \ -e 's/^class JSONCodingKey: CodingKey {/final class JSONCodingKey: CodingKey, Sendable {/' \ + -e 's/^public class JSONAny: Codable {/public final class JSONAny: Codable, @unchecked Sendable {/' \ "${OUTPUT}" prepend_license "swift" "${OUTPUT}"