A data formatter allows you to map a data type from your database to a specific display on the mobile side. For example, you can define a date, percentage, or currency format. Data formatters can also call some code to create intelligent interfaces.
For example, you can attach a data formatter to phone numbers that open an action menu on the mobile app when the user touches the number (e.g., to call the person or save them in contacts).
You have three formatter types:
Built-in formatters
This tutorial will show you how to apply built-in formatters to your fields. We will:
- define a format for a Boolean and a date,
- specify that a number is a percentage and another a currency.
Static formatters
The statics formatters allow formatting of the data. The transformation is described in a JSON file. You can download statics formatters from the gallery or create your own. For example, the formatter “BoolToImage” in the gallery displays a red circle when the value is false and a green circle for the true value.
This tutorial shows you how to create your formatters:
- text to text,
- integer to text,
- integer to the image.
Dynamic formatters
The dynamic formatters contain Swift and Kotlin code for iOS and Android. As for the static formatters, you can download them from the gallery or create your own formatters. In the documentation, you have a tutorial with a step-by-step example to create a formatter for Swift and one for Kotlin.
This video will show you how to get a formatter from the gallery and integrate it into your project.
Next…
Voilà! Now you know how to format your data in your mobile application. To go further, you can continue with the blog or the documentation.