• 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: Instantiate NSString from NSURL in Swift
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Instantiate NSString from NSURL in Swift


  • Subject: Re: Instantiate NSString from NSURL in Swift
  • From: Kyle Sluder <email@hidden>
  • Date: Mon, 23 Feb 2015 10:49:24 -0600

On Mon, Feb 23, 2015, at 08:18 AM, Juanjo Conti wrote:
> Hi!
>
> I'm translating some code from Objective-C to Swift and in the middle of
> that, i found this problem.
>
> theUrl is an instance of NSURL
>
> theUrl.host?.lowercaseString
>
> compiles ok.
>
> But
>
> NSString(string: theUrl.host?.lowercaseString)
> don't. It says "Value of optional type 'String?' no unwrapped; did you
> mean
> to use '!' or '?'?
>
> If I click to add the fix, then it complains again and suggest to delete
> the '!' :)

First, try it on Swift 1.2, which is currently available as part of the
Xcode 6.3 beta: <https://developer.apple.com/xcode/downloads/>

If you are able to reproduce this bad diagnostic on Swift 1.2/Xcode 6.3,
file a bug at <http://bugreport.apple.com>.

--Kyle Sluder
_______________________________________________

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: Instantiate NSString from NSURL in Swift
      • From: Marco S Hyman <email@hidden>
References: 
 >Instantiate NSString from NSURL in Swift (From: Juanjo Conti <email@hidden>)

  • Prev by Date: Re: How to translate this form objc to swift? (__unsafe_unretained)
  • Next by Date: scale text proportionally as bounds increase
  • Previous by thread: Instantiate NSString from NSURL in Swift
  • Next by thread: Re: Instantiate NSString from NSURL in Swift
  • Index(es):
    • Date
    • Thread