Swift SDK

Easily build e-commerce applications for all Apple platforms using the Swift SDK

About the Swift SDK

The Swift SDK is compatible with all four Apple platforms (iOS, watchOS, tvOS, and macOS). The main difference between the Swift SDK and the other SDKs is the fact that it is build with mobile clients in mind. Essentially, by using it, you gain access to all endpoints available using the scopes designed for mobile and single page (web) apps, without having to worry about the HTTP calls and serialization / deserialization. Certain platform-specific features and integrations (for example support for iOS application extension, watch app syncing, etc.) are also included.

The SDK is licensed under the Apache License, version 2.0. You can integrate the SDK either by using CocoaPods dependency manager, or using the Swift Package Manager.

Link list to the Swift SDK resources:

Features

Authentication

The API client automatically authenticates using OAuth 2.0 and securely stores the retrieved access and refresh tokens to the appropriate keychain, depending on the platform being used.

commercetools Endpoints Integration

The SDK contains methods and models for performing all actions available to the mobile clients. For any custom scenarios, you can benefit from the default extensions provided for the generic endpoints, where you can set the path for an endpoint, and still get the networking part abstracted away. Every endpoint method comes in two variants - one with the model, and the other with plain JSON / dictionary, for custom use cases.

iOS Application Extensions Support

The Swift SDK supports keychain sharing between the main iOS application and its extensions. That practically means that you can create extensions (for example today extension, notification content extension, etc.), and they will have access to the customer's access token, shared securely from the main iOS app. This can be really useful when showing some customer related content in the today widget, or for the rich notifications.

Watch App Support

Since the authorization tokens cannot be shared using keychain between the main iOS and the watchOS app, the SDK supports sharing them using WatchConnectivity.

Developer Center
HTTP APIGraphQL APIPlatform Release NotesCustom ApplicationsBETASDKs & Client LibrariesImport & ExportSUNRISE Starter FrontendsTutorialsFAQ
Merchant Center
DocumentationRelease Notes
Sign upLog inTech BlogIntegrationsStatusSupportUser Research Program
Copyright © 2022 commercetools
Privacy PolicyImprint