Hi,
I'm trying to convert the following code snippet to Swift:
NSURL* pathURL = [NSURL fileURLWithPath:path];
BOOL success = [pathURL setResourceValue:tags forKey:NSURLTagNamesKey error:&outError];
However, it looks like the equivalent is now blocked in the API definition - in the Xcode 12 Swift API declaration .tagNames (and allValues) are get-only properties of URLResourceValues (according to StackOverflow, they were mutable in the past).
extension URL {
func setTagNames(_ tags: [String] ) {
var values = URLResourceValues()
values.tagNames = tags // Error here: Cannot assign to property: tagNames is get-only
try self.setResourceValues( values )
}
}
How can I set the tagNames?
Thanks,
Thomas