matthewcheok / Realm-JSON

A concise Mantle-like way of working with Realm and JSON.
MIT License
661 stars 129 forks source link

relationships not working when using swift #28

Closed haemi closed 9 years ago

haemi commented 9 years ago

I defined my RLMObject-Models in Swift and defined a relationship like the following:

dynamic var children = RLMArray(objectClassName: MYCategory.className())

With this, I get nil for modelClass in RLMObject+JSON.mh#145:

Class modelClass = NSClassFromString([[self class] className]);

which works as soon as I add

@objc(MyCategory)

above my swift class implementation. But then, I get the following error:

RLMArray properties require a protocol defining the contained type - example: RLMArray<Person>

thrown in RLMProperty.mm#151

Is there a way to map relationships for models defined in Swift?