I have switch. One of the cases must be a count of array:
int count = [array count];
switch (someValue) {
case 0:
[self foo];
break;
case count:
[self bar];
break;
default:
break;
}
But compiler tolds:
Expression is not an integer constant expression
How to make const int from [array count]?
As the error suggests, the cases must all be constants. You’ll need an
ifstatement to check the dynamic case: