After completing this guide, your iOS app will be themed according to your branding. Before following these steps, make sure you've successfully created a theme with the Backbase Visualizer.
From the exporter you should have a folder that includes:
|
Description |
Contents |
|---|---|
|
The design tokens file |
defaultTokens.json |
|
A logos folder with your brand's logos |
.pdf logo files |
|
A fonts folder with your brand's fonts |
.ttf or .otf font files |
Import token file
Unzip and open the theme.zip file and copy the defaultTokens.json to your project in Xcode.
Initialise the Mobile Design System SDK
Add these lines to the AppDelegate.swift file:
Theme.decodingInfo.filename = "defaultTokens"
// The bundles to look for the file
Theme.decodingInfo.bundles = [.main]
You only need to change this if your default token file has a different name. By default it will look for defaultTokens in bundle .main and .design. Make sure that this is set before the Design System has been used, as the first usage of a token will trigger the Design System to ingest the tokens from the JSON.
Import logos
For in-app logos, it's best to use the .pdf format. This will ensure that the logos will scale properly to different screen sizes. Overriding Backbase's logos is as easy as importing four images into your project's .xcassets.
Add explicit light and dark logos
In order for you to be able to use the light and dark version of the logo explicitly, regardless of the device’s preferred color mode you can also import all of the standalone files with -light and -dark suffixes. Add these files to your assets and make sure to configure the Appearance field to None.
Import fonts
For iOS you will need to have the font files in .tff format, which have a separate font file for each font weight.
Map the font files to the correct font weights
Inside your AppDelegate.swift, you can edit the font filename mapping to use the custom font files you have. Simply match the name of the file to the corresponding font weight. Do not include the .ttf extension in the filename.
DesignSystem.shared.fonts = DesignSystem.Fonts(fontFileNameMappings: [
.black: "LibreFranklin-BlackItalic",
.bold: "LibreFranklin-BoldItalic",
.heavy: "LibreFranklin-ExtraBoldItalic",
.ultraLight: "LibreFranklin-ExtraLightItalic",
.light: "LibreFranklin-LightItalic",
.medium: "LibreFranklin-MediumItalic",
.regular: "LibreFranklin-Italic",
.semibold: "LibreFranklin-SemiBoldItalic",
.thin: "Li
You have now successfully applied your theme to your app using the design system tokens!