this is my piece of code:
NSUInteger indexArr[] = {1,2,3,4};
NSIndexSet *indexSet = [NSIndexPath indexPathWithIndexes:indexArr length:4];
Is there a way to declare the indexArr inline, like
NSIndexSet *indexSet = [NSIndexPath indexPathWithIndexes:{1,2,3,4} length:4];
or something? It's because I'm writing a test with some reference Paths and I want to save lines of code that are not usefull for anybody...
Best regards, hijolen
The only problem with your attempt is that you need to cast it so that the compiler knows it is the right type.
NSIndexSet *indexSet = [NSIndexPath indexPathWithIndexes:(NSUInteger[]){1,2,3,4} length:4];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With