Skip to content

#88 Continuation: Make AcceleratedCheckouts.Configuration Sendable#274

Merged
kieran-osgood-shopify merged 1 commit into
mainfrom
kieran-osgood/swift6/applepay-configuration-environment-value
Jun 16, 2026
Merged

#88 Continuation: Make AcceleratedCheckouts.Configuration Sendable#274
kieran-osgood-shopify merged 1 commit into
mainfrom
kieran-osgood/swift6/applepay-configuration-environment-value

Conversation

@kieran-osgood-shopify

@kieran-osgood-shopify kieran-osgood-shopify commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

What changes are you making?

This is an optional, but encouraged step towards API consistency and preventing future incompatibility issues, following on from #88.
#88 migrated the Customer from ObservableObject to struct, so that internal app wiring was simpler.
#274 makes the parent objects of Customer (Configuration -> AcceleratedCheckoutsConfiguration -> Customer) all structs.

This helps simplify our library code, as well as reduce the public maintenance contract (including easing the mental overhead of understanding what the library is doing) when we are in a strict concurrency world.

Warning

This is a breaking change to the V3 API

The breaking change will mean changing two statements:
image.png
image.png

How to test


Before you merge

Important

  • I've added tests to support my implementation
  • I have read and agree with the Contribution Guidelines
  • I have read and agree with the Code of Conduct
  • I've updated the relevant platform README (platforms/swift/README.md and/or platforms/android/README.md)

Releasing a new Swift version?
  • I have bumped the version in ShopifyCheckoutKit.podspec
  • I have bumped the version in platforms/swift/Sources/ShopifyCheckoutKit/ShopifyCheckoutKit.swift
  • I have updated platforms/swift/CHANGELOG.md
  • I have updated the SwiftPM/CocoaPods version snippets in platforms/swift/README.md (major version only)
Releasing a new Android version?
  • I have bumped the versionName in platforms/android/lib/build.gradle
  • I have updated platforms/android/CHANGELOG.md
  • I have updated the Gradle/Maven version snippets in platforms/android/README.md

Tip

See the Contributing documentation for the full release process per platform.

@github-actions

github-actions Bot commented Jun 11, 2026

Copy link
Copy Markdown

React Native — Coverage Report

Lines Statements Branches Functions
Coverage: 92%
91.66% (319/348) 87.86% (181/206) 100% (82/82)

@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/swift6/applepay-configuration-environment-value branch 3 times, most recently from 6a7cd0d to 8467a9d Compare June 12, 2026 09:15
@kieran-osgood-shopify kieran-osgood-shopify changed the title Make ApplePayConfiguration a SwiftUI environment value (Optional) Make ApplePayConfiguration a SwiftUI environment value Jun 12, 2026
@kieran-osgood-shopify kieran-osgood-shopify changed the title (Optional) Make ApplePayConfiguration a SwiftUI environment value (Optional continuation of #88) Make Configurations Sendable Jun 12, 2026
@kieran-osgood-shopify kieran-osgood-shopify changed the base branch from kieran-osgood/swift6/storefront-sendable-cache to graphite-base/274 June 12, 2026 10:58
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/swift6/applepay-configuration-environment-value branch from 8467a9d to 96088b4 Compare June 12, 2026 12:54
@kieran-osgood-shopify kieran-osgood-shopify changed the base branch from graphite-base/274 to kieran-osgood/swift6/storefront-sendable-cache June 12, 2026 12:54
@kieran-osgood-shopify kieran-osgood-shopify changed the title (Optional continuation of #88) Make Configurations Sendable #88 Continuation: Make Configurations Sendable Jun 12, 2026
@kieran-osgood-shopify kieran-osgood-shopify changed the title #88 Continuation: Make Configurations Sendable #88 Continuation: Make AcceleratedCheckouts.Configuration Sendable Jun 12, 2026
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/swift6/storefront-sendable-cache branch from 50f73e7 to 230c9ac Compare June 12, 2026 15:08
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/swift6/applepay-configuration-environment-value branch 2 times, most recently from a57ebf5 to 91a4072 Compare June 15, 2026 08:46
@kieran-osgood-shopify kieran-osgood-shopify changed the base branch from kieran-osgood/swift6/storefront-sendable-cache to graphite-base/274 June 15, 2026 09:13
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/swift6/applepay-configuration-environment-value branch from 91a4072 to 9c3861b Compare June 15, 2026 13:17
@kieran-osgood-shopify kieran-osgood-shopify changed the base branch from graphite-base/274 to kieran-osgood/swift6/storefront-sendable-cache June 15, 2026 13:17
@kieran-osgood-shopify kieran-osgood-shopify marked this pull request as ready for review June 15, 2026 13:19
@kieran-osgood-shopify kieran-osgood-shopify requested a review from a team as a code owner June 15, 2026 13:19
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/swift6/storefront-sendable-cache branch from efdbeec to 71fa876 Compare June 15, 2026 13:35
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/swift6/applepay-configuration-environment-value branch from 9c3861b to 877d467 Compare June 15, 2026 13:36
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/swift6/storefront-sendable-cache branch from 71fa876 to f769683 Compare June 15, 2026 13:50
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/swift6/applepay-configuration-environment-value branch from 877d467 to f8cfa26 Compare June 15, 2026 13:51
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/swift6/storefront-sendable-cache branch from f769683 to 94c8089 Compare June 15, 2026 14:07
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/swift6/applepay-configuration-environment-value branch 2 times, most recently from 06180b5 to db6d494 Compare June 15, 2026 14:39
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/swift6/storefront-sendable-cache branch 2 times, most recently from d4cc791 to 592b689 Compare June 16, 2026 08:49
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/swift6/applepay-configuration-environment-value branch from db6d494 to 297b04a Compare June 16, 2026 08:49
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/swift6/storefront-sendable-cache branch from 592b689 to e723503 Compare June 16, 2026 09:07
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/swift6/applepay-configuration-environment-value branch from 297b04a to 40fc6e7 Compare June 16, 2026 09:07
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/swift6/storefront-sendable-cache branch 2 times, most recently from aa15323 to 2ae6a1e Compare June 16, 2026 10:41
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/swift6/applepay-configuration-environment-value branch from 40fc6e7 to 57b8638 Compare June 16, 2026 10:41
@kieran-osgood-shopify kieran-osgood-shopify changed the base branch from kieran-osgood/swift6/storefront-sendable-cache to graphite-base/274 June 16, 2026 10:54
kieran-osgood-shopify added a commit that referenced this pull request Jun 16, 2026
### What changes are you making?
> [!IMPORTANT]
> When reviewing, consider these changes alongside the ones in #274. 
> #88 highlighted an issue with ObservableObjects + Swift Concurrency that makes it awkward from a library perspective. 
> To head off future issues and to encourage consistency in the API, I've added #274 as a recommended but not "essential" step in the Swift 6 migration


This PR makes the Storefront/GraphQL checkout path safe to use from Swift concurrency contexts by tightening Sendable boundaries around the Storefront client, cache, request/response values, and test doubles.

> [!WARNING]
> This intentionally includes a breaking Swift API change: `ShopifyAcceleratedCheckouts.Customer` is now a `Sendable` value type instead of an `ObservableObject` class.
>
> `Customer` is checkout identity data, not independently-owned UI state. Modeling it as an immutable struct matches normal Swift/SwiftUI patterns: app/configuration state owns and publishes values, while async/network code receives safe value snapshots.

Consumers should continue to observe the configuration object and assign a new customer value when inputs change:

```swift
@StateObject private var configuration = ShopifyAcceleratedCheckouts.Configuration(
    storefrontDomain: EnvironmentVariables.storefrontDomain,
    storefrontAccessToken: EnvironmentVariables.storefrontAccessToken
)

configuration.customer = ShopifyAcceleratedCheckouts.Customer(
    email: email.isEmpty ? nil : email,
    phoneNumber: phone.isEmpty ? nil : phone
)
```

The sample app was updated to use this pattern in:

```text
platforms/swift/Samples/ShopifyAcceleratedCheckoutsApp/ShopifyAcceleratedCheckoutsApp/ShopifyAcceleratedCheckoutsApp.swift
```

This removes the need for an internal `CustomerIdentity` wrapper and lets Storefront cart creation accept `Customer?` directly.

### How to test

Validated locally:

- `dev swift test`
- `dev swift lint`
- `dev swift api check`
- `dev swift build samples`

---

### Before you merge

> [!IMPORTANT]
>
> - [x] I've added tests to support my implementation
> - [ ] I have read and agree with the [Contribution Guidelines](./CONTRIBUTING.md)
> - [ ] I have read and agree with the [Code of Conduct](./CODE_OF_CONDUCT.md)
> - [ ] I've updated the relevant platform README (`platforms/swift/README.md` and/or `platforms/android/README.md`)

---

<details>
<summary>Releasing a new Swift version?</summary>

- [ ] I have bumped the version in `platforms/swift/ShopifyCheckoutKit.podspec`
- [ ] I have bumped the version in `platforms/swift/Sources/ShopifyCheckoutKit/ShopifyCheckoutKit.swift`
- [ ] I have updated `platforms/swift/CHANGELOG.md`
- [ ] I have updated the SwiftPM/CocoaPods version snippets in `platforms/swift/README.md` (major version only)

</details>

<details>
<summary>Releasing a new Android version?</summary>

- [ ] I have bumped the `versionName` in `platforms/android/lib/build.gradle`
- [ ] I have updated `platforms/android/CHANGELOG.md`
- [ ] I have updated the Gradle/Maven version snippets in `platforms/android/README.md`

</details>

> [!TIP]
> See the [Contributing documentation](./CONTRIBUTING.md) for the full release process per platform.
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/swift6/applepay-configuration-environment-value branch from 57b8638 to f4f109d Compare June 16, 2026 10:54
@graphite-app graphite-app Bot changed the base branch from graphite-base/274 to main June 16, 2026 10:55
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/swift6/applepay-configuration-environment-value branch from f4f109d to 2d5f5d7 Compare June 16, 2026 10:55
@kieran-osgood-shopify kieran-osgood-shopify merged commit 230f909 into main Jun 16, 2026
24 checks passed

Copy link
Copy Markdown
Contributor Author

Merge activity

@kieran-osgood-shopify kieran-osgood-shopify deleted the kieran-osgood/swift6/applepay-configuration-environment-value branch June 16, 2026 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants