I’m in the process of re-writing some obj-c code in swift for OS X and am stumped on how to set tab stops. The relevant obj-c code looks like this:
[paraStyle setTabStops:[NSArray array]]; for (cnt = 1; cnt <= numStops; cnt++) { tabStop = [[NSTextTab alloc] initWithType:NSLeftTabStopType location: tabInterval * (cnt)]; [paraStyle addTabStop:tabStop]; [tabStop release]; } [attrs setObject:paraStyle forKey:NSParagraphStyleAttributeName]; [paraStyle release]; [[textView textStorage] addAttributes:attrs range:NSMakeRange(0, [[[textView textStorage] string] length])]; [attrs release]; Most of my swift code compiles, but not the line corresponding to tabStop = [[NSTextTab alloc] initWithType:NSLeftTabStopType location: tabInterval * (cnt)]; 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. Boyd _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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 arch...@mail-archive.com