On Mar 21, 2015, at 20:43 , Charles Srstka <cocoa...@charlessoft.com> wrote:
> 
> I’m pretty sure that “real” Swift strings are different from NSStrings at 
> runtime. It’s not like NSString/CFString; it has to do an actual conversion, 
> and is not toll-free bridged. If you convert between String and NSString a 
> lot, it’ll have performance implications (which is why bridging to NSString 
> just to get -UTF8String isn’t really a good idea).

What’s interesting about that is (assuming my playground test is correct) the 
native Swift String type only “acquires” cStringUsingEncoding when Cocoa is 
imported.

That means either:

a. The native class actually has that method, but doesn’t expose it to the 
world without “import Cocoa”, OR

b. The native class must implement some kind of selector forwarding that 
translates that method into a message to a real NSString conversion of the 
String instance, or some such roundabout thing.

Option (a) seems strange, but option (b) seems even stranger.

_______________________________________________

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