Skip to content

[Swift] 4.0.0

Latest

Choose a tag to compare

@github-actions github-actions released this 28 Oct 17:04
Immutable release. Only release title and notes can be modified.
e24a2ba

🎉 Checkout Kit 4.0.0 for Swift is here!

This is a major milestone: the first stable release of Checkout Kit for Swift, the successor to Checkout Sheet Kit. Bring Shopify checkout into your app with your store's branding, Checkout UI extensions, Shopify Functions, and supported payment methods intact.

Built on the Embedded Checkout Protocol, 4.0.0 brings typed checkout events, flexible UIKit and SwiftUI presentation, observable preloading, and deeper control over appearance and navigation. The package also includes Shop Pay and Apple Pay buttons through ShopifyAcceleratedCheckouts—with your app in control of the cart.

Thank you to everyone who tried the SDK, reported issues, and helped shape this release. We're excited to see what you build! 🚀

Explore the Checkout Kit documentation and the Swift integration guide.

Install with Swift Package Manager:

.package(url: "https://github.com/Shopify/checkout-kit", exact: "4.0.0")

Add ShopifyCheckoutKit to your app target, and optionally ShopifyAcceleratedCheckouts for accelerated checkout buttons. Requires Swift tools 6.0+ and iOS 15+; accelerated checkout buttons require iOS 16+.

Breaking changes

Move lifecycle calls to ShopifyCheckout. The old lifecycle entry points have been removed; your import ShopifyCheckoutKit stays the same.

-ShopifyCheckoutKit.configure { $0.logLevel = .debug }
-ShopifyCheckoutKit.preload(checkout: checkoutURL)
-ShopifyCheckoutKit.present(checkout: checkoutURL, from: self, delegate: self)
-ShopifyCheckoutKit.invalidate()
+ShopifyCheckout.configure { $0.logLevel = .debug }
+ShopifyCheckout.preload(checkout: checkoutURL)
+ShopifyCheckout.present(checkout: checkoutURL, from: self, delegate: self)
+ShopifyCheckout.clearPreload()
  • Configuration and appearance: read the snapshot at ShopifyCheckout.configuration and make shared changes with the main-actor ShopifyCheckout.configure { ... } API. Use CheckoutAppearance, CheckoutColorScheme, and CheckoutColors in place of the old nested appearance types and configuration-level color properties. Shared configuration changes invalidate preloads; preload again afterward. SwiftUI .appearance(...) and .title(...) overrides apply only to that checkout instance.
  • Color names: rename webViewBackground → webViewBackgroundColor, headerBackground → headerBackgroundColor, headerFont → headerTitleColor, progressIndicator → progressIndicatorColor, and closeIconTint → closeIconTintColor, including initializer labels. closeIcon and headerBorderColor are unchanged.
  • Buy Now carts: replace ShopifyAcceleratedCheckoutButtons(variantID:quantity:) with an existing cartID or the new variantID:getCart: initializer. Your app creates or reuses the cart after the buyer selects a wallet; see the cart-provider example.
  • Protocol models and wallets: construct models with required arguments and configuration closures for optional fields; use with { ... } for modified copies. Protocol values such as checkout status and message severity, and the Wallet type, are extensible values. Include a default case when switching over them.
  • Preload states: replace .idle with .idle() and .expired with .idle(reason: .expired). Invalidation reports .idle(reason: .invalidated); operational failures remain .failed(reason:message:).
  • Links and failures: replace CheckoutLinkAction.open with .default. When migrating a delegate from checkoutDidFail(error:), implement checkoutDidFail(_ event: CheckoutFailureEvent) and read event.error.

Additive changes

  • A richer connection to checkout. Typed start, update, and completion events expose checkout snapshots, including totals, line items, fulfillment, and messages, so your app can react as checkout changes.
  • Presentation that fits your app. Present an SDK-managed sheet with ShopifyCheckout.present, or host ShopifyCheckout in your own SwiftUI presentation. Use storefront styling or app-defined light, dark, and automatic appearance palettes.
  • Checkout ready before the tap. Preload when the buyer approaches checkout and observe loading, readiness, expiry, or failure. Checkout falls back to a normal load when a reusable preload isn't available.
  • Shop Pay and Apple Pay buttons. Add ShopifyAcceleratedCheckoutButtons to your SwiftUI cart or product experience, with an existing cart or an app-supplied Buy Now cart provider.
  • Better visibility and testability. Public start, update, and completion event initializers support test fixtures. New readiness-duration and order-confirmation diagnostics help identify checkout sessions that never became ready or reached confirmation without a completion event.

Behaviour changes

  • Completion and dismissal are separate. Completing an order leaves the confirmation page visible; defer cart clearing that would tear down checkout until dismissal.
  • When Checkout Kit closes a presentation after a terminal failure, the failure callback runs first and the dismissal callback follows after closure. Caller-controlled UIKit dismissal or clearing a SwiftUI sheet binding does not invoke the SDK dismissal callback.
  • Embedded checkout reads shared appearance and title defaults when displayed. Instance overrides still take precedence, and the default progress indicator is lighter in dark mode.
  • Invalidating an empty preload cache preserves its last state and reason without notifying observers. Apple Pay presentation failures now reach onFail, and accelerated checkout dismissal is reported when the Apple Pay presentation closes.
  • CheckoutSheet and AcceleratedCheckoutButtons remain deprecated aliases. Use ShopifyCheckout and ShopifyAcceleratedCheckoutButtons in new code.

Full Swift changelog: 4.0.0 release details

Thank you to our contributors

Thank you to @adrian-augustyn, @arpitjain099, @jenny-walsh, @jordanliddle, @josemiguel-alvarez, @Juanita-Dash, @kev-mao, @kieran-osgood-shopify, @kiftio, @kyle-schellen, @markmur, @michaeljsXu, @Osarumwense, @raginpirate, @rsomlette, @tiagocandido, @toneymathews, @westeezy, and @WilsonChiang for helping bring Checkout Kit 4.0.0 from its first prereleases to this stable release! Your contributions across product, UX, the SDKs, protocol, documentation, and tooling made this milestone possible.