The Obj-C property is called "hidden." This means that the basic logic element is called _hidden, and for you 3 accessors are automatically synthesized: 2 isHidden : isHidden and hidden plus one setter: setHidden .
In Obj-C, using dot notation, you can set a property only with:
myMenuItem.hidden = YES; // or NO
or in a regular message:
[myMenuItem setHidden:YES];
to get the value you can: myMenuItem.hidden , myMenuItem.isHidden , [myMenuItem hidden] or [myMenuItem setHidden]
Now Swift is borrowing its naming convention from (in my opinion, lingua inferior) C and C ++. The Boolean property will have both its own setter and getter with the name "isHidden".
When Xcode converts Cocoa Obj-C Framework headers with an Obj-C interface defining a hidden property, it synthesizes the "isHidden" swift property, which is read / write.
This is why you can use both getter and setter:
if myMenuItem.isHidden { }
and
myMenuItem.isHidden = true // or false
Hope this addresses the issue.
source share