The Telerik Platform product is retired.Learn more

Telerik Platform Data Model

Telerik Platform Data Model

As you already know, Telerik Platform allows you to define your data model and takes care of storing the data in the cloud. The data model consists of one or more content types, each defining some fields. To work with this data model from the iOS SDK, you must define corresponding classes in your app. The Backend Services iOS SDK will take care of calling the Backend Services RESTful API and translating the data to/from instances of your classes.

System Fields

Each Telerik Platform content type has several built-in fields, that are always present. Every item has values for those fields. Here is a list of the system fields:

  • Id – the unique ID of the item
  • CreatedAt – the date and time when the item was created
  • ModifiedAt – the date and time when the item was last modified
  • CreatedBy – the ID of the user who created the item
  • ModifiedBy – the ID of the last user who modified the item

Values for those fields are maintained internally by Telerik Platform, you can read them, but you cannot modify them.

Defining Your Data Classes

Data classes are classes that represent a single record from a Telerik Platform content type. For example, if you have a content type named Books, you will need a data class to represent a single book in your iOS application.

The standard way to define your data classes is to extend the EVObject class. This will give you the following features out-of-the-box:

  • Working with Telerik Platform system fields
  • Updating items by setting properties

Here is a sample class extending EVObject:

@interface Books : EVObject

@property NSString *title;
@property NSString *author;
@property NSDate *publishedAt;


You need to name the model class after the Telerik Platform content type name.

Creating an Access Point to a Content Type

The flow is as follows:

​1. Obtain the sharedInstance of the EVDataStore singleton class. The EVDataStore is an abstraction over your Telerik Platform data store.

Here is an example of how to do this:

EVDataStore *dataStore = [EVDataStore sharedInstance];

​2. Execute CRUD operations over your content types.

Here is an example that retrieves all Activities items from the server:

[dataStore fetchAll:[Activities class] block:^(NSArray *result, NSError *error) {

In order to use this code you should define an Activities class that extends the EVObject class and is mapped to your Telerik Platform content type.

More information can be found here.

Each method of the EVDataStore is available in two flavors for asynchronous execution with callbacks:

  • Blocks
  • Selectors

More information can be found here.

​In the following sections you will find more examples of the available operations.

Mapping Types

When creating your data classes, it is important to know what Objective-C type to use for each property so that it can be properly serialized. In the following table you will find the proper type mappings.

Telerik Platform Type Objective-C Type
 Id  NSString
 Text  NSString
 Number  NSNumber
 Date and Time  NSDate
 File  EVFile
 GeoPoint  EVGeoPoint

Now that you know what types your properties need to be, you can easily mimic the Telerik Platform data model in your iOS app.

Mapping Property Names

Mapping between your Objective-C class and the corresponding Telerik Platform type is made by matching their names. By default we are assuming that the fields of your Telerik Platform content type are named PascalCase. Because of the convention in iOS that property names are camelCase, every time you are sending an object to the server, we are preparing the payload for the request by renaming your properties from camelCase to PascalCase.

So if we use the above mentioned Book class to create a book in Telerik Platform, before sending the request, we will set the body as follows:

    "Title" : "Book title"
    "Author" : "Book author"
    "PublishedAt" : "09/09/2013"

Basically if you have named your Telerik Platform content type fields starting with capital letters (e.g PascalCase) and the property names in your application are the same but in camelCase, then you don't have to write any additional code to map them.

But if you want to create your own mapping between the Telerik Platform fields and your properties, you just have to override getEverlivePropertiesMapping method, which is part of the EVObject class and return a dictionary with the matching names. The key for every pair is the property name in your application and value is the name of the Telerik Platform content type field.

-(NSDictionary*) getEverlivePropertiesMapping
    return @{
        @"title" : @"Title",
        @"author" : @"BookAuthor"
        @"publishedAt" : @"PublicationDate"
Contact us: +1-888-365-2779
Copyright © 2016-2018, Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.