Group Group Group Group Group Group Group Group Group

raywenderlich.com Forums

Video Tutorial: Beginning Realm on iOS Part 6: Conclusion

This conclusion video reviews what you learned in this series and speaks of what's coming next in our Intermediate Realm on iOS video tutorial series.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/3479-beginning-realm-on-ios/lessons/7

Great intro to Realm.

I have one question - is it possible to have Results<> represent more than one different Type of object?

Lets say I have 4 different types of objects - each not associated with one another - stored in Realm. I’d like to have Results<> update my tableView with these different types of objects.

Would you need to create an artificial relationship class of some sort to ‘wrap’ all the different types of objects under one Results<> Type?

Hi pixelblur, Results is typed and can contain only objects of the same type (as are collection types in general in Swift).

If you really want to mix different objects together you will need hold them in a different structure. For example you might try to create an Array<AnyObject> and just add all of your objects of different types to that array - then have a switch over the type of the current object in your tableView(_:, cellforRowAtIndexPath:) method.

SIr where is entity relationship ? I didnt see