Jens,

Thanks very much for the suggestions.  Re the possible error in my Obj-C code:  
Apple's documentation for NSTextTab shows 2 ways to create an NSTextTab; the 
first is  initWithType:location: (which is what I used in my  Obj-C code) and 
the second is initWithTextAlignment:location:options:  Further down in the 
docs, there is a table showing the correspondence between alignments and tab 
stop types.

In my swift code, I’ve tried just about every permutation I can think of to get 
the type of tab or alignment that I want, but to no avail.  It occurred to me 
that perhaps swift 1.2, which is what I’m using, might not work; I’ll give 
swift 2 a try.

Boyd


> On Aug 27, 2015, at 5:47 PM, Jens Alfke <[email protected]> wrote:
> 
> 
>> On Aug 27, 2015, at 5:32 PM, Boyd Collier <[email protected]> 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 protected])

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 [email protected]

Reply via email to