On Sat, Mar 21, 2015, at 10:10 PM, Jens Alfke wrote: > > > On Mar 21, 2015, at 8:43 PM, Charles Srstka <cocoa...@charlessoft.com> > > wrote: > > > > 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). > > Then what would be the best way, given a String, to pass it to a C API > that wants a char*?
String has a .utf8 property that returns a UTF8View. UTF8View is a Collection of UInt8, and therefore a SequenceType. Array has an initializer that takes a SequenceType. --Kyle Sluder _______________________________________________ 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