I am trying to check the download status of my url using resourceValues(forKeys:). This is my code
if let status = try? url.resourceValues(forKeys: [URLResourceKey.ubiquitousItemDownloadingStatusKey]) {
if status.ubiquitousItemDownloadingStatusKey == .current {
print("File download complete.")
}
}
This code worked before but now Xcode says "Value of type 'URLResourceValues' has no member 'ubiquitousItemDownloadingStatusKey'" and all I am able to get from status is some thumbnailDictionary. Can anyone tell me what is happening here? Am I making some silly mistake ?
You're using the wrong property on URLResourceValues
:
if let values = try? url.resourceValues(forKeys: [.ubiquitousItemDownloadingStatusKey]),
let status = values.ubiquitousItemDownloadingStatus {
if status == .current {
print("File download complete.")
}
}