I have an NSArray, and I am declaring that variable inside a function locally and used inside in for loop. But while I Analyze code it appears to be an error or an issue. The issue is Dead store - Values stored to 'elements' during initialisation is never read. But I do use that variable inside a for in loop…
Visual Description :

So the question is, Why compiler says that after creating NSArray I haven’t read anywhere in my code?
P.S. Code runs as I intended, but I just want to know why is this issue showing up?
Thanks for any explanation given.
You’re allocating memory for
elemntsand initialising it, and then two lines later you overwrite that variable having never used the allocated memory!Just write this instead: