1
votes

I am trying to create rlmobject with rlmarray as one of elemnts but cant get it to work.

declaration:

 dynamic var contactInfo : RLMArray = RLMArray(objectClassName: "ContactInfoDB")

and insertion:

tempLocation.contactInfo.addObject(tc)

where tc is

class ContactInfoDB: RLMObject

but somehow after add the array is still empty. Is there eny other way to insert object into rlmarray with swift using realm for objective c, because I need it to work also in iOS7.

Thank you for any help.

1

1 Answers

5
votes

I've been used Realm for Objective-C, but it should be the same. To make any changes on your db, you should follow the steps:

realm.beginWriteTransaction()

// Do what you have to do with your Realm objects

realm.commitWriteTransaction()

This link can help you : How to use RLMArray to save an Array