> On Mar 21, 2015, at 6:41 PM, Jens Alfke <j...@mooseyard.com> wrote:
> 
>> On Mar 21, 2015, at 2:13 PM, Quincey Morris 
>> <quinceymor...@rivergatesoftware.com 
>> <mailto:quinceymor...@rivergatesoftware.com>> wrote:
>> 
>> Well, “String” is not “NSString”.
> 
> Sure, but it’s bridged with NSString. The “Using Swift With Cocoa” book says: 
> “Swift automatically bridges between the String type and the NSString class. 
> This means that anywhere you use an NSString object, you can use a Swift 
> String type instead  … you should almost never need to use the NSString class 
> directly in your own code.”

The implicit conversions between String and NSString were removed in Swift 1.2, 
in order to make the type system “simpler and more predictable". The 
documentation you’re quoting is simply out of date.

> On Mar 21, 2015, at 6:58 PM, Quincey Morris 
> <quinceymor...@rivergatesoftware.com> wrote:
> 
> The difference is mundane: String happens to have a “cStringUsingEncoding” 
> method, but not a “UTF8String” method. NSString happens to have both. I don’t 
> know why — though I can’t imagine it’s merely been overlooked in a class as 
> common as String — but that difference is the reason for the error message.

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.

Charles

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to