URL.setResourceValues() in Swift 3
URL.setResourceValues() in Swift 3
- Subject: URL.setResourceValues() in Swift 3
- From: Rick Mann <email@hidden>
- Date: Thu, 29 Sep 2016 04:18:49 -0700
I don't know if Xcode 8 just has more bugs showing headers, or what. But I'm trying to make this call, as documented in the docs:
let _ = fm.createIntermediateDirectories(destURL)
try destURL.setResourceValues([. isExcludedFromBackup : true])
But I get "Value of type 'Bool' does not conform to expected dictionary value type 'AnyObject'" on the true. So I tried:
var vals = URLResourceValues()
vals.isExcludedFromBackup = true
try destURL.setResourceValues(vals)
But I get "Cannot convert value of type 'URLResourceValues' to expected argument type '[URLResourceKey : AnyObject]'" on the "vals" argument. The problem is that the docs say it's supposed to take [URLResourceKey : Any].
The Swift interface file generated by Xcode looks like this:
public mutating func setResourceValues(_ values: URLResourceValues) throws
But that's clearly not what the compiler sees.
Damn these bugs really suck.
Anyone know how to make this call work?
Thanks.
--
Rick Mann
email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden