| name | ios-mobile-sdk |
| description | Integrate Salesforce Mobile SDK into iOS Swift apps. Covers creating a new app, adding SDK auth, SmartStore (encrypted local DB), MobileSync (cloud sync), and biometric auth (Face ID / Touch ID). Use when an iOS Swift project needs Salesforce login, encrypted local storage backed by SmartStore, sObject-to-soup synchronization, or biometric session locking. |
iOS Salesforce Mobile SDK Integration
This skill integrates the Salesforce Mobile SDK into iOS Swift applications. It is consumed by autonomous coding agents — every reference file is self-contained and contains exact source-of-truth code, file paths, and CLI commands.
Scenarios
Pick the reference file that matches the task. Scenarios are layered: each later one assumes the previous is already wired up.
Cross-cutting references:
Detection Rules
When the user request is ambiguous, run these checks against the working directory and pick the first scenario in the list below whose precondition is not met — even if the user asked for a later capability (e.g. a "sync" request lands on add-smartstore.md if userstore.json is not yet present, then chains forward):
- No Xcode project (
*.xcodeproj or *.xcworkspace) at the repo root → create-new-app.md.
- Project exists but no
import SalesforceSDKCore (or any SDK module) anywhere in *.swift → add-mobile-sdk.md.
- SDK imported, but no
userstore.json in the target's source folder → add-smartstore.md.
userstore.json exists, but no usersyncs.json → add-mobilesync.md.
- Biometric requested but no
biometricAuthenticationManager() reference → add-biometric-auth.md.
Invariants Across All Scenarios
These hold regardless of which scenario runs:
- Project shape: detect from disk in priority order. (1)
Podfile + project.yml → hybrid (Option A for the SDK; xcodegen for sources). (2) Podfile only → CocoaPods (Option A). (3) project.yml only → xcodegen + SPM (Option B-i). (4) .xcodeproj only → plain SPM (Option B-ii). Use the matching path in references/add-mobile-sdk.md.
- CocoaPods workspace rule: after
pod install, the build/open target is <AppName>.xcworkspace, never <AppName>.xcodeproj.
project.yml is the source-of-truth signal. When project.yml is not present, do not author one and do not run xcodegen generate against the existing .xcodeproj — regenerating drops the project's hand-maintained target/scheme configuration. When project.yml is present (with or without a Podfile), it is the source of truth and xcodegen generate is the correct way to land new files. The "Create New App" scenario authors project.yml and runs xcodegen generate from scratch.
- Code signing for simulator builds: use ad-hoc signing (
CODE_SIGN_IDENTITY=-). Never pass CODE_SIGNING_ALLOWED=NO — it strips the keychain entitlement and silently breaks login (see references/troubleshooting.md).
- Login host default:
login.salesforce.com for production, test.salesforce.com for sandboxes.
- Smoke test UI: each
setupRootViewController() example installs a labeled placeholder view — replace it with the real root view controller after the smoke test passes.
Source of Truth
When the SDK API in this skill disagrees with reality, the upstream Objective-C headers in https://github.com/forcedotcom/SalesforceMobileSDK-iOS win. Resolve a Swift name by grepping the SDK source for NS_SWIFT_NAME(<name>).