• 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: Why is NSString.UTF8String unavailable in Swift?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why is NSString.UTF8String unavailable in Swift?


  • Subject: Re: Why is NSString.UTF8String unavailable in Swift?
  • From: Quincey Morris <email@hidden>
  • Date: Sun, 22 Mar 2015 02:45:51 +0000

On Mar 21, 2015, at 18:55 , Charles Srstka <email@hidden> wrote:
>
> The thing that’s odd is that the native Swift String’s implementation of cStringUsingEncoding uses the Foundation NSStringEncoding constants instead of something that wouldn’t require importing Foundation.

> On Mar 21, 2015, at 18:46 , Jens Alfke <email@hidden> wrote:
>
> The implication there is that String inherits all methods of NSString, not that most of the NSString methods have been manually copied into String.


One more thing…

Jens is correct, actually. If you remove the “import Cocoa” from the playground, you’ll see that the basic String class doesn’t even have cStringUsingEncoding. (!)

So, I conclude, importing NSString.h:

— adds NSString methods to class String as an extension, AND

— adds an entirely new NSString class with the NSString methods, BUT

— for some reason, omits UTF8String in the first case, but adds it in the second case.




_______________________________________________

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: 
 >Why is NSString.UTF8String unavailable in Swift? (From: Jens Alfke <email@hidden>)
 >Re: Why is NSString.UTF8String unavailable in Swift? (From: Quincey Morris <email@hidden>)
 >Re: Why is NSString.UTF8String unavailable in Swift? (From: Jens Alfke <email@hidden>)
 >Re: Why is NSString.UTF8String unavailable in Swift? (From: Quincey Morris <email@hidden>)
 >Re: Why is NSString.UTF8String unavailable in Swift? (From: Charles Srstka <email@hidden>)

  • Prev by Date: Re: Why is NSString.UTF8String unavailable in Swift?
  • Next by Date: Re: Why is NSString.UTF8String unavailable in Swift?
  • Previous by thread: Re: Why is NSString.UTF8String unavailable in Swift?
  • Next by thread: Re: Why is NSString.UTF8String unavailable in Swift?
  • Index(es):
    • Date
    • Thread