Configure WebSockets
REST Wrappers for SFAP APIs
Using Key-Value Stores for Secure Data Storage
Dark Mode and Dark Theme Settings
Dark color schemes have recently become popular in user interfaces because they can reduce eye strain and improve screen readability. iOS and Android now support dark mode and dark theme, respectively, in their latest versions. To keep in sync with these developments, Mobile SDK 8.0 adds dark options for its native UI elements.
Dark schemes affect the following Mobile SDK dialog boxes:
In addition, the MobileSyncExplorer sample app and native template apps now support dark UIs.
Dark settings are managed as follows.
In Mobile SDK 8.2 and earlier, dark mode always follows the iOS setting on the mobile device. If your app isn’t yet compatible with dark mode, you can disable the feature statically. To do so, open your app’s Info.plist file and set the UIUserInterfaceStyle key to “Light”. Apple strongly recommends that you use this setting only if you need more time to update your app’s resources to dark mode. See “Choosing a Specific Interface Style for Your iOS App” at developer.apple.com.
Mobile SDK 8.3 introduces a userInterfaceStyle property on SFSDKWindowManager that lets you change the user interface mode at runtime. This setting applies to all windows that Mobile SDK manages as follows:
UIUserInterfaceStyle entry and also sets the userInterfaceStyle property, the property takes precedence.These examples use iOS dark theme APIs.
1// Swift
2SFSDKWindowManager.shared().userInterfaceStyle = .dark
3
4// Objective-C
5[SFSDKWindowManager sharedManager].userInterfaceStyle = UIUserInterfaceStyleDark;Dark theme in Mobile SDK apps is determined as follows:
In the SalesforceSDKManager class, Mobile SDK provides APIs for querying and toggling dark theme. If the dark option doesn’t agree with your app’s existing color scheme, you can revert Mobile SDK resources to the light setting. The Theme enum defines the possible states:
1public enum Theme {
2 LIGHT,
3 DARK,
4 SYSTEM_DEFAULT
5}These examples use Android dark theme APIs.
To query the theme setting, use this method:
1public boolean isDarkTheme()To force dark theme on or off, use the setTheme() method. This example turns off dark theme:
1SalesforceSDKManager.getInstance().setTheme(SalesforceSDKManager.Theme.LIGHT);We've Moved