• 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: Substring in Swift
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Substring in Swift (From: "Gerriet M. Denkmann" <email@hidden>)
 >Re: Substring in Swift (From: Jim Adams <email@hidden>)
 >Re: Substring in Swift (From: "Gerriet M. Denkmann" <email@hidden>)
 >Re: Substring in Swift (From: Quincey Morris <email@hidden>)

  • Prev by Date: Re: Substring in Swift
  • Next by Date: formatted strings in Swift
  • Previous by thread: Re: Substring in Swift
  • Next by thread: Re: Does setFormatter() retain?
  • Index(es):
    • Date
    • Thread