Skip to main content

iOS SDK Swift 6.3

Offer Scan & Go to your customers in your own iOS app with this SDK. The Snabble iOS SDK is built with Swift 6 and SwiftUI and supports the entire range of Snabble base functionality including scanning, shopping cart, promotions, payment, shops and receipts.

The SDK covers the whole communication with the Snabble Cloud-Platform and provides you with ready-to-use SwiftUI views, so that the integration of Scan & Go into your app is reduced to a few lines of code. See Getting Started for a minimal integration.

Requirements​

  • iOS 17.0 or later
  • Xcode 27.1 or later (the iOS 27.1 SDK is required to build)
  • Swift 6.3 or later

Installation​

The SDK is distributed via Swift Package Manager.

Xcode​

Select File → Add Package Dependencies… in Xcode's menu bar and enter the repository URL:

https://github.com/snabble/snabble-ios-sdk.git

Set the Dependency Rule to Up to Next Major Version starting from 1.0.0, then select the products you need, e.g. SnabbleScanAndGo.

Package.swift​

dependencies: [
.package(
url: "https://github.com/snabble/snabble-ios-sdk.git",
.upToNextMajor(from: "1.0.0")
)
]

Add the desired products to your target:

.target(
name: "MyApp",
dependencies: [
.product(name: "SnabbleScanAndGo", package: "Snabble"),
]
)

The product Snabble contains the complete SDK for convenience.

Modules​

The SDK is organized into five layers with no circular dependencies. Each module can be added individually.

ModuleLayerPurpose
SnabbleCoreFoundationBusiness logic, data models, cart management, offline product database
SnabbleNetworkFoundationAPI communication and authentication
SnabbleAssetProvidingFoundationTheming and asset management
SnabbleComponentsUI PrimitivesReusable SwiftUI components
SnabbleThemeUI PrimitivesAsset management with Core integration
SnabbleShopsDomain FeaturesShop list and shop details
SnabbleCartDomain FeaturesShopping cart UI
SnabbleUserDomain FeaturesUser management
SnabbleReceiptsDomain FeaturesReceipt display and local archiving
SnabblePaymentPaymentPayment processing with multiple provider support
SnabbleScanAndGoComplete FlowsComplete Scan & Go workflow (Shopper, ShopperView)
SnabblePhoneAuthComplete FlowsPhone-number-based OTP authentication
SnabbleCouponsComplete FlowsCoupon display and activation
SnabbleTeaserComplete FlowsPromotional teaser cards from backend config
SnabbleOnboardingComplete FlowsPaged onboarding flow configured via JSON

Details for each module are available in the API reference and in the module READMEs on GitHub.

Optional: Datatrans (Twint, PostFinance)​

In order to use the twint and postFinanceCard payment methods, add the SnabbleDatatrans product to your app. During the app's initialization phase call DatatransFactory.initialize(appCallbackScheme:) with your app's registered URL scheme to make these methods available.

Support for these payment methods also requires changes to your app's Info.plist as described in the Datatrans SDK documentation, as well as a URL scheme that can be used to pass data back to your app:

<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>YOUR_URL_NAME_HERE</string>
<key>CFBundleURLSchemes</key>
<array>
<string>YOUR_URL_SCHEME_HERE</string>
</array>
</dict>
</array>

Sample Apps​

The repository contains two sample apps, both running against the staging environment with demo credentials:

  • MinimalScanAndGo – one screen, two files. The smallest possible Scan & Go integration, ideal for getting started.
  • SwiftySnabble – a complete SwiftUI app with multi-tab navigation, onboarding, shops, receipts and payment methods.
git clone https://github.com/snabble/snabble-ios-sdk
cd snabble-ios-sdk
open Snabble.xcworkspace

Versioning​

Snabble follows semantic versioning rules. See the changelog for details on each release.