> On Sep 25, 2015, at 1:43 PM, Boyd Collier <bcoll...@mail.sdsu.edu> wrote: > > In objective-c programs, there are places where one can write lines like the > following: > > [scrollview setBorderType:NSNoBorder]; > > with NSNoBoarder being specified in an enum in NSView. But enums in swift > are a different sort of beast, and I’ve not yet figured out what get the same > job done. > Is there a straightforward way to do this? (I’m using swift 2 in Xcode 7)
Generally speaking, Objective-C enums get simplified in Swift so that the common prefixes are removed from the name of the constant. You access an enum by typing the enum type name, then a period, then the constant name (in your case, NSBorderType.NoBorder). However, if you have a property or parameter that is defined as that enum type, you can leave the enum type name out, and the compiler will infer it. So, all you have to do is this: scrollView.borderType = .NoBorder Charles _______________________________________________ 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