To create Mobile SDK Swift projects, you can assemble the pieces manually, or you can use the forceios create command. With forceios, specify native_swift as the application type, or simply press Return. For example:
1forceios create2Enter your application type(native, native_swift, leave empty for native_swift): <PRESS RETURN>3Enter your application name: TestSwift4Enter your package name: com.bestapps.swift5Enter your organization name(Acme, Inc.): BestApps, Inc.6Enter output directory for your app(leave empty for the current directory): TestSwift
In Mobile SDK, Swift methods and classes closely follow the related Objective-C API signatures. However, to facilitate calling Objective-C APIs, Mobile SDK defines Swift-friendly names for most methods and parameters. When Mobile SDK defines a custom Swift name, it appears in the Objective-C header file with the tag NS_SWIFT_NAME immediately following the Objective-C method declaration. Here’s an example method declaration:
If an Objective-C API is not available in Swift, you’ll see the tag NS_SWIFT_UNAVAILABLE("") next to the API declaration.
Most Swift class names are simply the Objective-C name without the “SF” prefix, but there are some refinements as well. For example, SFRestAPI equates to RestClient in Swift. Here are some noteworthy examples.
Objective-C
Swift
SalesforceSDKManager
SalesforceManager
SFUserAccountManager
UserAccountManager
SFRestAPI
RestClient
SFSmartStore
SmartStore
SFMobileSync*
MobileSync*
We've Moved
Welcome to the new home of the Mobile SDK Developer Guide! For now, the Japanese guide can be found in PDF form.