Swift Package Manager Distribution for Salesforce Mobile SDK for iOS

June 10, 2026 · View on GitHub

Pre-built XCFramework distribution of the Salesforce Mobile SDK for iOS, compatible with Swift Package Manager (SPM).

Overview

This repository provides pre-built binary frameworks (XCFrameworks) for the Salesforce Mobile SDK for iOS. It offers an alternative to CocoaPods for integrating the SDK into your Swift projects using Xcode's native Swift Package Manager.

Installation

  1. In Xcode, go to File → Add Package Dependencies
  2. Enter the repository URL:
    https://github.com/forcedotcom/SalesforceMobileSDK-iOS-SPM.git
    
  3. Select version or branch (e.g., 13.2.1 or master)
  4. Choose which libraries to add to your target:
    • SalesforceAnalytics - Telemetry and analytics
    • SalesforceSDKCommon - Shared utilities
    • SalesforceSDKCore - OAuth and REST API
    • SmartStore - Encrypted local storage
    • MobileSync - Data synchronization

Via Package.swift

For Swift packages, add this dependency to your Package.swift:

dependencies: [
    .package(
        url: "https://github.com/forcedotcom/SalesforceMobileSDK-iOS-SPM.git",
        from: "13.2.0"
    )
]

Then add products to your targets:

targets: [
    .target(
        name: "MyApp",
        dependencies: [
            .product(name: "MobileSync", package: "SalesforceMobileSDK-iOS-SPM"),
            .product(name: "SmartStore", package: "SalesforceMobileSDK-iOS-SPM"),
            .product(name: "SalesforceSDKCore", package: "SalesforceMobileSDK-iOS-SPM")
        ]
    )
]

Available Libraries

ProductDescription
SalesforceAnalyticsTelemetry, instrumentation, and analytics event tracking
SalesforceSDKCommonShared utilities, crypto helpers, and base protocols
SalesforceSDKCoreOAuth2 authentication, REST client, account management, push notifications
SmartStoreEncrypted on-device SQLite storage (SQLCipher-backed)
MobileSyncBidirectional data sync between device and Salesforce cloud

Platform Support

This package supports:

PlatformMinimum Version
iOS17.0
watchOS8.0
visionOS2.0
macCatalyst13.0

Usage Example

import SalesforceSDKCore
import MobileSync

// Configure SDK
SalesforceSDKManager.shared.connectedAppId = "YOUR_CONSUMER_KEY"
SalesforceSDKManager.shared.connectedAppCallbackUri = "sfdc://oauth/success"
SalesforceSDKManager.shared.authScopes = ["api", "web", "refresh_token"]

// Launch SDK
SalesforceSDKManager.shared.launch { [weak self] (launchActionList) in
    // SDK is ready
    self?.setupRootViewController()
}

// Use REST API
let request = RestClient.shared.request(
    forQuery: "SELECT Id, Name FROM Account LIMIT 10",
    apiVersion: nil
)

RestClient.shared.send(request: request) { result in
    switch result {
    case .success(let response):
        print("Accounts:", response.asJsonDictionary())
    case .failure(let error):
        print("Error:", error)
    }
}

What's Inside?

This repository contains:

  • Pre-built XCFrameworks: Binary frameworks for all supported architectures (arm64 device, arm64/x86_64 simulator)
  • Package.swift: Swift Package Manager manifest
  • Dependencies: Automatic integration of SQLCipher and FMDB (for SmartStore)

Architecture Support

Each XCFramework includes slices for:

  • iOS Devices: arm64 (iPhone, iPad)
  • iOS Simulator: arm64 (Apple Silicon Macs) + x86_64 (Intel Macs)
  • Mac Catalyst: arm64 + x86_64 (native Mac apps)
  • visionOS Device: arm64 (Apple Vision Pro)
  • visionOS Simulator: arm64 (Apple Silicon Macs only)

Binary vs Source Distribution

This Repository (Binary)

  • ✅ Faster integration (pre-compiled)
  • ✅ Smaller git clone
  • ✅ No build time for SDK libraries
  • ❌ Cannot debug into SDK source
  • ❌ Cannot modify SDK code

Source Repository

For SDK development or source-level debugging, use:

Alternative: CocoaPods

If you prefer CocoaPods over Swift Package Manager, see:

Version Compatibility

SPM PackageiOS SDKSwiftXcodeiOS Min
14.0.014.0.05.0+16+18.0
13.2.013.2.05.0+16+17.0
13.1.013.1.05.0+16+17.0
13.0.013.0.05.0+16+17.0

See release notes for detailed version history.

Dependencies

This package automatically includes:

  • SQLCipher: 4.10.0 (13.x) / 4.16.0 (14.x) - SQLite encryption (for SmartStore)
  • FMDB: 2.7.12-sqlcipher - Objective-C SQLite wrapper

These are managed automatically by Swift Package Manager.

Documentation

Getting Started

API Reference

Guides

For SDK Maintainers

Branch Model

This repo follows the same two-branch workflow as all other Mobile SDK repos:

  • master — stable, tagged release snapshots only
  • dev — active development for the next release

At release time, release.js in the Package repo merges dev → master, builds xcframeworks, commits, tags, then merges master → dev. For patch releases, changes are cherry-picked directly to master (no dev merge).

Building XCFrameworks

XCFramework builds are automated by release.js. To build manually:

# Build XCFrameworks from iOS SDK release tag
./build_xcframeworks.sh -r forcedotcom -b master

# Commit and tag (release.js does this automatically)
git add archives/ Package.swift
git commit -m "Mobile SDK 13.2.1"
git tag 13.2.1  # Note: no 'v' prefix for SPM tags
git push origin master
git push origin 13.2.1

Important: SPM tags must NOT have a v prefix (e.g., use 13.2.1, not v13.2.1).

Support

License

Salesforce Mobile SDK License. See LICENSE.md for details.