Hi,
I'm trying to convert the following code snippet to Swift:
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).
How can I set the tagNames?
Thanks,
Thomas
I'm trying to convert the following code snippet to Swift:
Code Block 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).
Code Block 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