The ASAP SDK allows you to customize the UI of the help widget as required.
Predefined themes
The SDK UI comes with two predefined themes: white and black. The following methods help you apply these themes.
If you want to change the theme, first include the following import statement, which imports the ZohoDeskPortalConfiguration.
Swift
- import ZohoDeskPortalConfiguration
Objective-C
- @import ZohoDeskPortalConfiguration;
Methods for applying the default theme (white)
Swift
- ZDPThemeManager.setTheme(type: .light)
Objective-C
[ZDPThemeManager setThemeWithType:ZDPThemeTypeLight];
Methods for applying the black theme
Swift
- ZDPThemeManager.setTheme(type: .dark)
Objective-C
- [ZDPThemeManager setThemeWithType:ZDPThemeTypeDark];
Versions of iOS 13 and up allow users to set dark or light themes throughout the system. You can set the system theme for iOS 13 and apply it to the ASAP Help Widget. The help widget will be in the same theme as the OS in such cases.
Swift
ZDPThemeManager.setTheme(type: .system)
Objective-C
- [ZDPThemeManager setThemeWithType:ZDPThemeTypeSystem];
• ZDPThemeType.system is available only for iOS 13 and above.
• By default, the system theme will be applied for iOS 13 and above, and the light theme will be applied for earlier versions.
Customized themes
You can also override the default dark and light themes to make the SDK look more like your application.
To update the default light theme:
Swift
ZDPThemeManager.updateLightTheme(theme: <#ZDPThemeProtocol#>)
Objective-C
[ZDPThemeManager updateLightThemeWithTheme:<#ZDPThemeProtocol#>];
To update the default dark theme:
Swift
ZDPThemeManager.updateDarkTheme(theme: <#ZDPThemeProtocol#>)
Objective-C
[ZDPThemeManager updateDarkThemeWithTheme:<#ZDPThemeProtocol#>];
Here, ZDPThemeProtocol contains the properties representing the most used colours across the SDK, such as primaryTextColor and navigationBarTextColor. All properties in the protocol are optional. You can create any class conforming to this protocol, implement one or more properties, and pass an object of that class to the updateLightTheme or updateDarkTheme method. The colours you set in the class will override the default theme.
Updating the SDK's theme is different from setting a theme type. Depending on the theme type you have set, the SDK will always be in a dark or light theme. Using custom fonts
The SDK UI offers a set of default fonts, but you can use fonts of your choice if you need to.
To be able to display custom fonts on the SDK UI, perform these steps:
1. Add the fonts to your project.
2. Edit the info.pilst Your app's list file should include the fonts provided by the application key.
3. Under this key, list the file names of all the fonts you want to use in the SDK UI.
After adding the fonts to your project, you can customize the SDK UI to display text in that font.
To display the custom font on your SDK UI, include the following method in your app code:
Swift
ZDPortalConfiguration.customFontName = <#String#>
Objective-C
ZDPortalConfiguration.customFontName = <#NSString#>;
The help widget displays the system font by default if you do not use a custom font. We have made the font sizes accessible since version 2.0. However, accessibility for custom fonts is supported only for iOS 11 and above.