Skip to content

Shopify/example-mobile--storefront--swift

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Mobile Storefront — Swift

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.

Tutorials

What's included

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

Use these snippets in your project

  1. Copy the relevant files into your iOS project's source tree.
  2. Add the Checkout Sheet Kit Swift package (and the ShopifyAcceleratedCheckouts module if you're using accelerated checkouts) via Swift Package Manager.
  3. In StorefrontClient.swift, replace {shop}.myshopify.com with your store domain and add your Storefront API access token.
  4. The samples target iOS 15 or later.

Requirements

  • 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_listings and unauthenticated_write_checkouts scopes

Contributing

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.

License

This project is licensed under the MIT License.

About

Example code repo for https://shopify.dev/docs/storefronts/mobile

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages