我在Swift中使用ObjectMapper的領域。我無法填充列表。它總是零。這裏是我的代碼:swift領域列表<T>不填充
import RealmSwift
import ObjectMapper
class Person: Object,GtMappable {
dynamic var id = 0
dynamic var name = ""
dynamic var listOfEmployees = List<Employee>()
required init() {
super.init()
}
required init?(_ map:Map) {
super.init()
mapping(map)
}
// Mappable
internal func mapping(map: Map) {
id = map["id"]
name = map["name"]
listOfEmployees <- map["result"]
}
}
listOfEmployees將拋出一個錯誤 - '屬性不能被標記爲動態的,因爲它的類型不能在Objective-C中表示 –