Re: setting tab stops in swift
Re: setting tab stops in swift
- Subject: Re: setting tab stops in swift
- From: Jens Alfke <email@hidden>
- Date: Thu, 27 Aug 2015 17:47:24 -0700
> On Aug 27, 2015, at 5:32 PM, Boyd Collier <email@hidden> wrote:
>
> I’ve tried
> let theTabStop: NSTextTab = NSTextTab(NSLeftTabStopType, loc, (tabInterval * cnt))
>
> but am told that NSLeftTabStopType is an “unresolved identifier”, which I understand has to do with enums being quite different in swift.
> Surely, the correct way to deal with this is relatively simple, but I’ve not yet come up with it. Any help would be greatly appreciated.
Command-click on ’NSTextTab’ to see the Swift definition. The first parameter to init isn’t a tab stop type, it’s an NSTextAlignment. (The Obj-C code you’re porting seems to be wrong, but it probably doesn’t matter because the correct enum has the same numeric value…) Command-click on NSTextAlignment and you’ll see the enum value you want is called just ‘Left’.
—Jens
_______________________________________________
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