• 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: How to convert String.Index to UInt?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to convert String.Index to UInt?


  • Subject: Re: How to convert String.Index to UInt?
  • From: "Gerriet M. Denkmann" <email@hidden>
  • Date: Sat, 16 Aug 2014 17:00:31 +0700

On 16 Aug 2014, at 16:04, Roland King <email@hidden> wrote:

> You can’t.
>
> 		let s : NSString = "hallo\there"
> 		let aas = NSMutableAttributedString( string: s, attributes: nil )
>
> 		let rangeOfTab  = s.rangeOfString( "\t" )
> 		if rangeOfTab.location != NSNotFound
> 		{
> 			let colour = UIColor.grayColor()
> 			let aRange = NSRange(location:0, length:rangeOfTab.location )
> 			aas.addAttribute( NSForegroundColorAttributeName, value: colour, range: aRange )
> 		}	}
>

Thanks. Works fine.


> After 1+ months are you sure Swift is worth all this effort?

Well...

First: I think Swift is going to be the future, so I might as well start learning it now.

But:
The speed of Swift is still not so swift.
I just ran an app which has two versions: the running time in Swift beta 5 is only 76 % of beta 4 (which is a nice improvement), but it is still 10 % slower than Obj-C.

The error messages are not always as helpful as they could be.

The documentation (the two Swift books) is not really complete, nor up to date.
I just looked for "distance" and found only something about km and miles.
And "lazy" is still spelled "@lazy".
Xcode offers about "distance" only MKRoute (whatever that is).

Can only get better.

But I kind of like the language. Feels fresh and new.  Going back to ObjC feels like switching from Retina to some old display.


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


  • Follow-Ups:
    • Re: How to convert String.Index to UInt?
      • From: Roland King <email@hidden>
References: 
 >How to convert String.Index to UInt? (From: "Gerriet M. Denkmann" <email@hidden>)
 >Re: How to convert String.Index to UInt? (From: Roland King <email@hidden>)

  • Prev by Date: Re: How to convert String.Index to UInt?
  • Next by Date: Creating pdf document
  • Previous by thread: Re: How to convert String.Index to UInt?
  • Next by thread: Re: How to convert String.Index to UInt?
  • Index(es):
    • Date
    • Thread