Prerequisites
If you are a Backbase user, the following prerequisites are already in place.
- Install cocoapods and cocoapods-art.
- (Optional) Install Bundler to manage your cocoapod gem installation.
- (Optional) Install rbenv to manage your Ruby versions.
- Set up your repo user by following the Getting started for iOS.
Set up dependencies
- To download the design system dependencies, add the Backbase Cocoapod repository for the design system as follows:
pod repo-art add backbase-pods-retail3 https://repo.backbase.com/api/pods/ios-retail3
pod repo-art add backbase-pods-design https://repo.backbase.com/artifactory/api/pods/design-ios
pod repo-art update backbase-pods-design
pod repo-art update backbase-pods-retail3
- Then, in the Podfile add the following:
plugin 'cocoapods-art', sources: %w[
backbase-pods-design
backbase-pods-retail3
]
- Now, you can run pod install in your console to download the Backbase Design System Cocoapods.
Initialize the Design System
- First, import the BackbaseDesignSystem package into your app.
import BackbaseDesignSystem
- Now you will be able to use Design System via DesignSystem.shared
- If you want to load a custom theme, see apply a theme.
Example usage
The following example shows how you can create create a component using the Backbase Design System and how to style it:
let primaryButton: Button = {
let button = Button()
DesignSystem.shared.styles.primaryButton(button)
button.setTitle("Button primary", for: .normal)
return button
}()
let input: TextInput = {
let input = TextInput(accessibilityLabel: "Text input", usesTextFieldPaddingsForHeight: true)
input.titleLabel.text = "Title"
input.helperLabel.text = "Helper text"
input.errorImage = UIImage(named: DesignSystem.Assets.icError, in: .design, compatibleWith: nil)
DesignSystem.shared.styles.textInput(input)
input.textField.accessibilityLabel = "defaultTextInput"
return input
}()