• 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
Re: URL.setResourceValues() in Swift 3
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: URL.setResourceValues() in Swift 3


  • Subject: Re: URL.setResourceValues() in Swift 3
  • From: Quincey Morris <email@hidden>
  • Date: Thu, 29 Sep 2016 13:54:50 -0700
  • Feedback-id: 167118m:167118agrif8a:167118swmKCvuxvO:SMTPCORP

On Sep 29, 2016, at 13:29 , Rick Mann <email@hidden> wrote:
>
> So, it turns out, destURL was a let, not a var. That made the difference. Sure seems like a bad diagnostic.

Yes, with that piece of extra information, I can see the same behavior in Xcode 8.1 that you originally described (with AnyObject instead of Any, as you said).

> However, there's also a problem in that the documentation in Xcode 8 is:
>
> 	func setResourceValues(_ keyedValues: [URLResourceKey : Any]) throws

I think what’s happening is that three different things are getting confused by the compiler (because destURL was not mutable, so the “natural” setResourceValues for type URL could not be inferred):

1. The setResourceValues method of URL (URLResourceValues).

2. The setResourceValues method of NSURL, translated across the Swift 3 API conversion applied to the Obj-C-based SDK ([URLResourceKey:Any]).

3. The setResourceValues method signature of NSURL, derived directly from the SDK header file without Swift 3 translation ([URLResourceKey:AnyObject]).

Obviously, #3 shouldn’t be happening. It doesn’t seem like #2 should be happening either, given that Swift 3 isn’t supposed to bridge automatically any more. And, yes, the error message is a secondary error that obscures the real problem.

So this may be 3 bugs rather than just 1. 3 gold stars for you.

_______________________________________________

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


References: 
 >URL.setResourceValues() in Swift 3 (From: Rick Mann <email@hidden>)
 >Re: URL.setResourceValues() in Swift 3 (From: Quincey Morris <email@hidden>)
 >Re: URL.setResourceValues() in Swift 3 (From: Rick Mann <email@hidden>)

  • Prev by Date: Re: URL.setResourceValues() in Swift 3
  • Next by Date: Have tool tips displayed longer?
  • Previous by thread: Re: URL.setResourceValues() in Swift 3
  • Next by thread: Implementing own text prediction on UITextField
  • Index(es):
    • Date
    • Thread