Skip to main content

Default theme

The QuickBlox iOS UIKit comes with the default Theme conforms toThemeProtocol out of the box. It consists of a ThemeColor, ThemeFont, ThemeImage and an ThemeString that describe the properties needed to properly display the appearance of the kit.

Color Theme

Color Theme
iOS Doc Light
iOS Doc Dark
The default ColorTheme conforms to the ThemeColorProtocol:
Swift
which describes the required a color set to properly display the user interface:
Swift
This theme supports Light and Dark schemes configured with ColorSet in Xcode: If you are not yet using Color Sets in your application, you can get acquainted with them in the documentation from Apple documentation

Use your own Color Theme

You can create and use your own color theme. To do this you need to create a class that implements QuickBloxUIKit\.ThemeColorProtocol and initialize it with your own color set. The example shows different options for color constructors. Use the most suitable for you:
Swift
Now that you’ve successfully created your color theme, it’s time to apply it to QuickBlox iOS UIKit’s screens. To do this, let’s create a YourAmazingTheme class corresponding to QuickBloxUIKit.ThemeProtocol, which obliges to do initialization with ThemeColorProtocol, ThemeFontProtocol, ThemeImageProtocol and ThemeStringProtocol:
Swift
Next, we create an object of this class:
Swift
Now it remains to install your theme. You can do this in a place convenient for you in your application, for example, at the entry point to the QuickBlox iOS UIKit:
Swift

Font Theme

The default FontTheme conforms to the ThemeFontProtocol:
Swift
with such default fonts:
Swift

Use your own Font Theme

You can create and use your own font theme. To do this you need to create a class that implements QuickBloxUIKit.ThemeFontProtocol with the fonts you need. For example:
Swift
Setup this in a place convenient for you in your application:
Swift

Image Theme

The default ImageTheme conforms to the ThemeImageProtocol:
Swift
with such default images:
Swift

Use your own Image Theme

You can create and use your own images theme. To do this you need to create a class that implements QuickBloxUIKit.ThemeImageProtocol with the images you need. For example set up images for the Info Dialog screen:
Swift
Setup this in a place convenient for you in your application:
Swift

String Theme

The default StringTheme conforms to the ThemeStringProtocol:
Swift
By default, QuickBlox iOS UIKit supports English localization:
Swift
with such default strings:
Swift

Use your own String Theme

You can use your string values to uniquely design your application:
Swift
You can create and use your own string theme. To do this you need to create class that implements QuickBloxUIKit.ThemeStringProtocol:
Swift
Setup this in a place convenient for you in your application:
Swift
Your string values will apply to the QuickBlox iOS UIKit user interface, for example:
UIKit Example
Use Localization to expand the capabilities of your application. For custom localization, customize your application by adding the necessary localization files. You can learn more about how to do this at the Apple Documentation.
  1. Copy and add to the localization file in your project the necessary string constants from QuickBlox iOS UIKit. If you do not have a localization file yet, then create it following the guide from Apple Documentation.
  2. Customize these constants as you need for your purposes.
  3. Create and add the necessary localization files to your project.
For example, add a localization file for Spanish to your project:
Localization Example
  1. Customize localization files according to the language they represent. For example, add a localization file for Spanish:
Swift
Now if Spanish is set as the main language on the device of the user of your application, then your application will automatically respond to this and the user interface will change:
UIKit Example