Controlling Objective-C getter name for stored properties?

The Obj-C convention for properties is


@property (nonatomic, getter=isEnabled) BOOL enabled.


In Swift Interoperability in Depth at about the 48 minute mark, the speaker talks about using @objc(isEnabled) to change the name of the getter that is exported to Obj-C.


What is the correct syntax for doing this for for a stored property, where I am not supplying the getter or the setter?


The example given on the slide appears to only be applicable to computed properties:


var enabled: Bool {
   @objc(isEnabled) get { … }
    set { … }
}


—Jim

I think you end up needing to use a computed property backed by a private stored property, if you want to export it that way in objC:


private var _enabled: Bool = false
var enabled: Bool {
    @objc(isEnabled) get {return _enabled}
    set {_enabled = newValue}
}
Controlling Objective-C getter name for stored properties?
 
 
Q