• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
URL.setResourceValues() in Swift 3
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: URL.setResourceValues() in Swift 3
      • From: Quincey Morris <email@hidden>
  • Prev by Date: Re: Mystery Threads
  • Next by Date: Implementing own text prediction on UITextField
  • Previous by thread: Re: Mystery Threads
  • Next by thread: Re: URL.setResourceValues() in Swift 3
  • Index(es):
    • Date
    • Thread