NSControl isEnabled only available in OS X v10.0 through OS X v10.9
Asked Answered
B

1

2

Does anybody know why NSControl's isEnabled has been removed while setEnabled: is still working?

Beaujolais answered 24/2, 2015 at 21:24 Comment(0)
J
2

In OS X 10.10 (and iOS 8), many of the getter/setter method pairs in Apple's frameworks were replaced by @property declarations. This both makes the header interface clearer and makes the import of those APIs into Swift more... well, Swifty.

// Before
- (BOOL)isEnabled;
- (void)setEnabled:(BOOL)enabled;

// After
@property(getter=isEnabled) BOOL enabled

The documentation hasn't been fully updated to reflect that, so it erroneously shows isEnabled as deprecated, even though the @property declaration means you can still do any of the following:

BOOL foo = [control isEnabled];
[control setEnabled:YES];
BOOL bar = control.enabled;
control.enabled = YES;
Judon answered 24/2, 2015 at 22:10 Comment(1)
Thanks! This also applies to the continuous method / property. However many of the other declarations that are crossed out in the NSControl docs are actually deprecated: I've tried to decode this a bit in this answer.Coarse

© 2022 - 2024 — McMap. All rights reserved.