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

Instantiate NSString from NSURL in Swift


  • Subject: Instantiate NSString from NSURL in Swift
  • From: Juanjo Conti <email@hidden>
  • Date: Mon, 23 Feb 2015 11:18:44 -0300

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 '!' :)

Thanks in advance,
--

Juanjo Conti <jjconti <http://goog_2023646312>@carouselapps.com
<email@hidden>>

Software Engineer - Carousel Apps <https://carouselapps.com>

--
Carousel Apps Limited, registered in England & Wales with registered number
7689440 and registered office Unit 2 Artbrand Studios, 7 Leathermarket
Street, London SE1 3HN. Any communication sent by or on behalf of Carousel
App Ltd or any of its subsidiary, holding or affiliated companies or
entities (together "Watu") is confidential and may be privileged or
otherwise protected. If you receive it in error please inform us and then
delete it from your system. You should not copy it or disclose its contents
to anyone. Messages sent to and from Watu may be monitored to ensure
compliance with our internal policies and to protect our business. Emails
are not secure and cannot be guaranteed to be error free. Anyone who
communicates with us by email is taken to accept these risks.
_______________________________________________

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: Fritz Anderson <email@hidden>
    • Re: Instantiate NSString from NSURL in Swift
      • From: Kyle Sluder <email@hidden>
  • Prev by Date: Latest Documentation for adding Applescript Support to an Objective-C Project
  • Next by Date: How to translate this form objc to swift? (__unsafe_unretained)
  • Previous by thread: Re: Latest Documentation for adding Applescript Support to an Objective-C Project
  • Next by thread: Re: Instantiate NSString from NSURL in Swift
  • Index(es):
    • Date
    • Thread