Skip to main content

iOS - Access Theme Colors

note

Modules conforming to the Module interface can access an instance of ModuleDataSource via the moduleDataSource property.
Use this instance to retrieve the theme colors consumed by Q2MobileCore. :::

To retrieve current colors used by Q2MobileCore, use the ThemeProvider available through the theme property in the ModuleDataSource interface.

Example

Use the following code snippet to access a color for a given key. If the key does not exist, it will return UIColor.clear.

Accessing Theme Color
let themeColor = moduleDataSource?.theme?.color(forKey: "color-key")
let uiThemeColor = themeColor.uiColor
You can reference color-key using the sample