In the program, I write a string that changes the boolean value to the opposite.
someObject.boolValue = ![someObject boolValue];
How can you write correctly (without dot-syntax) the left side of the expression. That is, using only square brackets?
In the program, I write a string that changes the boolean value to the opposite.
someObject.boolValue = ![someObject boolValue];
How can you write correctly (without dot-syntax) the left side of the expression. That is, using only square brackets?
Can so
[someObject setBoolValue:![someObject boolValue]];
But it's better to replace it somehow with a separate method that will work with an internal variable, because in your example two messages are sent (setter + getter), although you can do with one.
Source: https://ru.stackoverflow.com/questions/171543/
All Articles