I just converted my project to Swift 3 and I got an error to directory.path
row:
Error: Value of type 'String' has no member 'stringByAppendingPathComponent'.
I've already tried let realmPath = (directory as NSString).stringByAppendingPathComponent
instead, I have got the following error:
Cannot convert value of type 'URL' to type 'NSString' in coercion.
override func awake(withContext context: Any?) {
super.awake(withContext: context)
let directory: URL = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: "group.RazvanJulian.app")!
let realmPath = directory.path.stringByAppendingPathComponent("db.realm") /* ERROR */
RLMRealm.setDefaultRealmPath(realmPath)
realmToken = RLMRealm.default().addNotificationBlock { note, realm in
self.reloadTableData()
}
reloadTableData()
}
Please check it and let me know.
Thank you in advance!