class 내에 하위 class 선언 불가
같은 레벨로 선언해야함
오류 메시지: Thread 1: "RLMObject subclasses cannot be nested within other declarations. Please move _TtCC5_4Person14Dog to global scope."
class Dog: Object {
@objc dynamic var name = ""
@objc dynamic var owner: Person? // Properties can be optional
}
class Person: Object {
@objc dynamic var name = ""
@objc dynamic var birthdate = Date(timeIntervalSince1970: 1)
let dogs = List<Dog>()
}
추가한 object 타입의 class는 모두 configuration에 추가해야함
오류 메시지: Invalid class subset list:\n- 'Dog' links to class '_TtCC5_4Person14Dog', which is missing from the list of classes managed by the Realm
let config = Realm.Configuration(objectTypes: [Dog.self, Person.self])
let realm = try! Realm(configuration: config)