Get started
Integration
The Common UI SDK is a core configuration module for all DriveKit UI modules.
To add Common UI module to your app, add the following pod to your podfile:
Then, run pod install
On this Github repository, you have a demo app and source code that you can use as an example.
Initialization
If you have disabled the SDK auto-initialization, an initialization phase is required to ensure that Common UI module works perfectly. To initialize Common UI module in your app, you must call the initialization method in didFinishLaunchingWithOptions
method of your AppDelegate file.
This method will initialize the SDK with the default configuration set up by DriveQuant.
It is possible (from Swift, not Objective-C) to provide some parameters to this DriveKitUI initialization method in order to set custom values for colors (colors: DKColors
), fonts (fonts: DKFonts
), and/or text localization (overridedStringsFileName: String?
).
Configurations
Colors
The colors that can be configured are listed in the table below:
Name | Description | Default value |
| Main app color | #0B4D6E |
| Call to action color | #77E2B0 |
| Main font color | #161616 |
| Secondary font color | #9E9E9E |
| Color of a text displayed on an element whose color is primaryColor | #FFFFFF |
| Color of a text displayed on an element whose color is secondaryColor | #FFFFFF |
| Background color | #FAFAFA |
| Color of the separating lines | #F0F0F0 |
| Warning color (non-critical hint) | #F7A334 |
| Alert color (critical hint) | #E52027 |
| Color of elements (title and items) in the navigation bar |
|
To override the default colors configuration, you should create a subclass of DKDefaultColors
and override the colors that you want to change (or you can create an object implementing the DKColors
protocol, necessary if your project is in Objective-C for instance). Then pass an instance of this object as a parameter of the configureColors
method.
Fonts
The Common UI configuration module allows to set up two fonts:
primaryFont
: this is the main font used in the application. The default value is Roboto.secondaryFont
: this is the font used on the page titles or to emphasize a specific point. The default value is Roboto.
To override the fonts, you can add the primary and secondary fonts to the CommonUI SDK by calling the configureFonts
method as in this following example:
Note: From Objective-C, it is not possible to subclass the DKDefaultFonts
class. To override the fonts, it is thus necessary to create a class implementing the DKFonts
protocol.
Text Localization
Contents of each DriveKit UI module are translated into 7 languages: English, French, German, Spanish, Italian, Danish and Portuguese.
DriveKit simplifies the internationalization of your application and it is possible to add other languages.
DriveKit Common UI contains a number of basic text keys used in other DriveKit UI modules. You can override these keys to customize your application.
To help make the text keys in the code easier to read, a specific nomenclature has been set up: dk_<module name>_<key description>
.
For the Common UI module, all localizable keys are prefixed with: dk_common
.
There are several files containing text keys:
A .strings file in the common UI module containing generic keys to all modules.
One file per UI module containing module-specific text keys.
Text customization
To override a text key in the common UI module, simply define the keys to be modified in a .strings file at the application level and configure the filename in the common UI module. The text keys can be directly retrieved on Github, in the Localizable folder of each module.
Add language
The translation file can be retrieved from GitHub. Add it to your application after adding the appropriate translation(s).
Get analytics
For analytics purposes, you can tag screens of any DriveKit UI component by providing to this following method an instance of an object conforming to DKAnalytics
protocol:
Where the Analytics object is for instance:
The screen
String received in the trackScreen
method is the value associated to one of the keys in this array, corresponding to the visited screen. If you want to customize screen tags, you can provide the path to a plist file (see the default tags file) with your custom values in the configuration method:
If, in the plist, a value is empty, the tracking is disabled for this screen.
The trackEvent
method allows you to add additional information that may be useful for analysis. For example, that method is called each time the user opens the trip detail screen.
Last updated