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
Post
Replies
Boosts
Views
Activity
Hi,I tried to imeplement some data clustering and separation algorithms with an Xcode playground - however I can't figure out how to create programmatically subfolders in *~/Documents/Shared Playground Data* as FileManager is not availabe in the playground. Any ideas? Thanks, Thomas