我正在尝试将Swift字符串数组[String]
写入Couchbase lite 2.7文档。 MutableDocument
具有方法setArray(value: ArrayObject?, forKey: String)
。如何将swift数组转换为ArrayObject?
ArrayObject
具有可变的副本MutableArrayObject
,其对应的初始化程序采用Array<Any>?
。这是一个例子:
let swiftArray = ["foo", "bar"]
let CBLArray = MutableArrayObject.init(data: swiftArray)
print(CBLArray.toArray())