My goal is to use SwiftyDropbox in my Swift iOS app to save the user's data and keep it synced between devices. I did this successfully by first deleting the existing file and then writing the updated file, but I would like to use the writemode update instead as that seems safer and better. The one thing I can't figure out is what String to use in the call mode: .update(String). I tried using the same string as the path and that resulted in an error.
I hope this isn't a dumb question, but I've spent the last hour scouring google, the documention, and this forum and I can't seem to find this answer.
Thank you!
let encodedCompleteLibrary = try? JSONEncoder().encode(completeLibrary)
if _inDropboxSyncMode, let client = DropboxClientsManager.authorizedClient {
if let fileData = encodedCompleteLibrary {
let pathString: String = UserDefaultsKeys.dropboxFolderName + UserDefaultsKeys.completeLibraryFilename
client.files.upload(path: pathString, mode: .update(?????), autorename: false, mute: false, input: fileData)
.response { response, error in
if let response = response {
self._inOfflineMode = false
print(response)
} else if let error = error {
self._inOfflineMode = true
print(error)
}
}
}