title: Storing an array of strings using Realm's RLMArray
body: <p>Does anyone know how you can use Realm to store an array of strings? I'm trying to map the following response into Realm correctly:</p>
  
  <pre><code>"zoneInfo": {
      "tariffInfoLines": [
          "In this city you pay per minute."
      ]
  }
  </code></pre>
  
  <p>We have a zoneInfo object that contains a tariffInfoLines array. This tariffInfoLines array contains strings. In Realm there are two different variable types for storing data. The first is <a href="https://realm.io/docs/objc/latest/api/Classes/RLMObject.html" rel="noreferrer">RLMObject</a> which allows your standard NSString, int, long etc.</p>
  
  <p>The second type is <a href="https://realm.io/docs/objc/latest/api/Classes/RLMArray.html" rel="noreferrer">RLMArray</a>, which is used for arrays (as NSArray is not supported). You have to give the array a type, which must be a class that subclasses RLMObject. We have so far got around this by using a ABCRealmString object, as shown below:</p>
  
  <pre><code>@property RLMArray&lt;ABCRealmString&gt; *tariffInfoLines;
  </code></pre>
  
  <p>ABCRealmString contains an NSString property (it is basically a wrapper):</p>
  
  <pre><code>@property NSString *value;
  </code></pre>
  
  <p>However what this means is that when Realm tries to map the response to persist the data, it is looking for a value for the key "value" (the name of the property). It appears that it expects a response similar to the following:</p>
  
  <pre><code>"zoneInfo": {
      "tariffInfoLines": [
          {
              "value": "In this city you pay per minute."
          },
      ]
  }
  </code></pre>
  
  <p>In the project, we have it working for the following structure:</p>
  
  <pre><code>"userOptions": [
      {
          "wantsEmailNotifications": true,
          "wantsPushNotifications": false
      },
  ]
  </code></pre>
  
  <p>This has an array, with objects inside that have clear key value pairs that Realm can map to. The zoneInfo structure appears to be the only place that we have an array with sets of values inside without them being inside an object or having any keys.</p>
  
  <p>If anyone could shed some light on this, regarding if this is possible using Realm, or whether an API change is required to match a structure that Realm can map.</p>