Reputation: 3541
I have a variable that is a block type with Bool return and void params.
@property (nonatomic, copy) BOOL (^shouldDisplayView)(void);
I implement this block in another class of mine
myClass.shouldDisplayView = ^BOOL(void) {
return self->_count > 0;
};
I want to execute this block and check for the result, like:
if (result of shouldDisplayView is true) ...
Is it simply
if (shouldDisplayView)
or is this checking if it's non-null?
Upvotes: 1
Views: 34
Reputation: 12144
if (myClass.shouldDisplayView)
will check shouldDisplayView
isn't nil
.
If you want to check result of shouldDisplayView
is true
, it should be
if (myClass.shouldDisplayView && myClass.shouldDisplayView())
Upvotes: 1