Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2,593 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Snabble iOS SDK

License Swift 6.2 Contact

Self-scanning and checkout SDK for iOS, built with Swift 6 and SwiftUI.

Requirements

  • Xcode 17.0 or later
  • iOS 17.0 or later
  • Swift 6.2

Installation

Swift Package Manager via Xcode

Select File > Add Package Dependencies... in Xcode, then 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.

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"),
    ]
)

Architecture

The SDK is organized into five layers with no circular dependencies:

Layer 1 — Foundation

  • SnabbleCore — business logic, data models, cart management, offline database (GRDB)
  • SnabbleNetwork — API communication and authentication
  • SnabbleAssetProviding — theming and asset management

Layer 2 — UI Primitives

  • SnabbleComponents — reusable SwiftUI components
  • SnabbleTheme — asset management with Core integration

Layer 3 — Domain Features

  • SnabbleShops — shop and store views
  • SnabbleCart — shopping cart UI
  • SnabbleUser — user management
  • SnabbleReceipts — receipt display and local archiving

Layer 4 — Payment

  • SnabblePayment — payment processing with multiple provider support

Layer 5 — Complete Flows

  • SnabbleScanAndGo — complete Scan & Go workflow (ShopperView)
  • SnabblePhoneAuth — phone-number-based OTP authentication
  • SnabbleCoupons — coupon display and activation
  • SnabbleTeaser — promotional teaser cards from backend config
  • SnabbleOnboarding — paged onboarding flow

Modules

Each module has its own README with entry points, key components, and dependency details:

Module Layer README
SnabbleCore 1 Core/README.md
SnabbleNetwork 1 Network/README.md
SnabbleAssetProviding 1 AssetProviding/README.md
SnabbleComponents 2 Components/README.md
SnabbleTheme 2 Theme/README.md
SnabbleShops 3 Shops/README.md
SnabbleCart 3 Cart/README.md
SnabbleUser 3 User/README.md
SnabbleReceipts 3 Receipts/README.md
SnabblePayment 4 Payment/README.md
SnabbleScanAndGo 5 ScanAndGo/README.md
SnabblePhoneAuth 5 PhoneAuth/README.md
SnabbleCoupons 5 Coupons/README.md
SnabbleTeaser 5 Teaser/README.md
SnabbleOnboarding 5 Onboarding/README.md

Integration

Scan & Go

SnabbleScanAndGo provides a complete, self-contained Scan & Go interface. It handles barcode scanning, cart management, payment method selection, and checkout.

Check the user into a shop first, then create a Shopper:

import SnabbleScanAndGo

Snabble.shared.checkInManager.checkIn(shop: shop)
let shopper = Shopper(shop: shop)

Present ShopperView in a NavigationStack:

import SnabbleScanAndGo

struct ShoppingContainer: View {
    @State private var shopper: Shopper?

    var body: some View {
        NavigationStack {
            if let shopper {
                ShopperView(model: shopper)
            }
        }
    }
}

Apply .actionState() once at the root of your view hierarchy. This modifier connects the ActionManager to your UI so that toasts, dialogs, sheets, and alerts triggered during a session are actually displayed. Without it, these overlays will be silently swallowed.

RootView()
    .environment(router)
    .actionState()

ShopperView covers the full session lifecycle:

  • Barcode scanning with camera and manual entry
  • Shopping cart management (quantities, deletion)
  • Payment method selection and configuration
  • Checkout with error handling

Payment Methods (optional, standalone)

import SnabblePayment

NavigationStack {
    PaymentMethodListView(
        projectId: project.id,
        analyticsDelegate: analyticsDelegate
    )
}

Optional: Datatrans (Twint, PostFinance)

To enable twint and postFinanceCard, add SnabbleDatatrans to your app and call DatatransFactory.initialize() during initialization with your registered URL scheme.

The Info.plist also requires a URL scheme entry as described in the Datatrans SDK documentation.

Example Apps

git clone https://github.com/snabble/snabble-ios-sdk
cd snabble-ios-sdk
open Snabble.xcworkspace

The workspace includes the SDK package and two example apps. See Example/README.md for a full comparison.

MinimalScanAndGo — one screen, two files, ~200 lines. The smallest possible ScanAndGo integration, ideal for getting started.

SwiftySnabble — a complete, production-oriented SwiftUI app with multi-tab navigation, router pattern, and full feature coverage.

Both apps use demo credentials against the staging environment. To integrate the SDK into your own app you need a production application identifier and secret — contact us for access.

Documentation

Full API reference: https://docs.snabble.io/snabble-ios-sdk/

Versioning

The SDK follows Semantic Versioning. Version 1.0.0 introduced Swift 6 language mode and is not backward compatible with 0.x releases. See documentation/Swift-6-Migration.md for the migration reference.

License

snabble is (c) 2021–2026 snabble GmbH, Bonn. The SDK is available under the MIT License.

About

The snabble iOS SDK

Topics

Resources

Stars

4 stars

Watchers

3 watching

Forks

Releases

Used by

Contributors

Languages