Re: Substring in Swift
Re: Substring in Swift
- Subject: Re: Substring in Swift
- From: "Gerriet M. Denkmann" <email@hidden>
- Date: Sat, 03 Sep 2016 11:51:33 +0700
> On 3 Sep 2016, at 00:23, Quincey Morris <email@hidden> wrote:
[…]
> My only quibble would be the double bridging:
>
>> let swiftString = uitv.text // bridging from NSString to String
>> let nsString = swiftString as NSString // bridging from String to NSString
>
> Technically, bridging is a value conversion, though in practice the underlying concrete NSString subclass likely survives the “conversion". The danger is that there’s no API contract that prevents the generated code from *really* converting the underlying representation, and that might lead you back into the non-uniqueness-of-representation problem. So, I’d suggest:
>
>> let nsString = uitv.text as NSString
>
> which keeps you in the NSString domain.
I did not know this. Thanks for telling me.
I have fixed my code accordingly.
Kind regards,
Gerriet.
_______________________________________________
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