Companion code for shopify.dev tutorials covering the Storefront API, Checkout Kit for Swift, and Customer Account API authentication.
This repository is not a standalone runnable app. It contains the source files referenced inline by the tutorials. To use them, drop the files into an existing iOS project and add the dependencies listed below.
| File | Description |
|---|---|
StorefrontClient.swift |
Storefront API client — product queries, cart creation, cart permalinks |
Models.swift |
Decodable response types for GraphQL responses |
ProductListView.swift |
SwiftUI product list with Add to Cart |
CartViewController.swift |
Checkout Kit integration with event handling |
AuthClient.swift |
OAuth + PKCE flow against the Customer Account API |
AcceleratedCheckout*.swift |
Accelerated checkout buttons, configuration, customization, events, and render-state handling |
- Copy the relevant files into your iOS project's source tree.
- Add the Checkout Sheet Kit Swift package (and the
ShopifyAcceleratedCheckoutsmodule if you're using accelerated checkouts) via Swift Package Manager. - In
StorefrontClient.swift, replace{shop}.myshopify.comwith your store domain and add your Storefront API access token. - The samples target iOS 15 or later.
- Xcode 14 or later
- iOS 15 or later
- A Shopify development store with at least one product
- A Storefront API access token with
unauthenticated_read_product_listingsandunauthenticated_write_checkoutsscopes
This repository doesn't accept issues or external contributions. It exists as a companion to the tutorials linked above. If you find an issue with the tutorial content, use the feedback form on the tutorial page.
This project is licensed under the MIT License.