How do I move a Realm object to a global scope

时间:2016-04-12 00:49:17

标签: swift2 realm

I am building an app using Swift2 and Realm to persist the data. The data relationships could be described as parent-to-child-to-grandchild objects. Each object has it's own subclass written with the same format. I am getting the runtime error "RLMObject subclasses cannot be nested within other declarations. Please move _TtCC12 ... to global scope.'" on the grandchild object. Any suggestions?

1 个答案:

答案 0 :(得分:3)

错误消息告诉您RealmSwift.Object子类的声明必须位于最外层,并且不能嵌套在其他类或结构声明或函数定义中。