我将此配置代码用于 Realm Encryption
let configuration = Realm.Configuration(encryptionKey: "key" as Data)
let realm = try! Realm(configuration: configuration)
我将此配置代码用于 Realm Sync with server
let configuration = Realm.Configuration(syncConfiguration: SyncConfiguration(user: user, realmURL: syncServerURL))
let realm = try! Realm(configuration: configuration)
我们如何使用Realm进行加密和与服务器同步?
答案 0 :(得分:2)
Realm.Configuration
initializer can accept multiple arguments如果您想指定配置的多个方面:
let config = Realm.Configuration(syncConfiguration: SyncConfiguration(user: user, realmURL: syncServerURL),
encryptionKey: theKey)