NSControl isEnabled is only available in OS X version 10.0 through OS X v10.9

Does anyone know why NSControl isEnabled was deleted when setEnabled: still works?

+2
source share
1 answer

In OS X 10.10 (and iOS 8), many pairs of getter / setter methods in Apple frameworks have been replaced by @property declarations. This makes the header interface more understandable and makes importing these APIs into Swift more ... well, Swifty.

 // Before - (BOOL)isEnabled; - (void)setEnabled:(BOOL)enabled; // After @property(getter=isEnabled) BOOL enabled 

The documentation has not been completely updated to reflect this, so it mistakenly shows isEnabled as deprecated, although the @property declaration means that you can still do one of the following:

 BOOL foo = [control isEnabled]; [control setEnabled:YES]; BOOL bar = control.enabled; control.enabled = YES; 
+2
source

Source: https://habr.com/ru/post/988829/


All Articles