我在这里有我的数据模型对象:
class Tiktoks: Object {
@objc dynamic var _id: ObjectId = ObjectId.generate()
@objc dynamic var _partition: String = ""
@objc dynamic var category: String = ""
@objc dynamic var date: Date = Date()
let tiktoks = RealmSwift.List<String>()
override static func primaryKey() -> String? {
return "_id"
}
convenience init(partition: String, category: String) {
self.init()
self._partition = partition;
self.category = category;
}
}
_partition
我修改and没有问题category
,但是由于tiktoks
列表是由 定义的let
,如果我将它放在convenience init
函数中以便我能够修改它,它将不起作用。我试着放在@objc dynamic var
它前面,但它说Property cannot be marked @objc because its type cannot be represented in Objective-C
。
有没有办法使用 mongoDB iOS Swift SDK 修改数组?