C.Johns
C.Johns

Reputation: 10245

how to check for non used variables in Xcode 4

I am wondering if there is an option in xcode that will let you debug a variable to see if it's being used in your code anywhere?

I find sometimes I make changes to my code, then I look at all of my synthesised variables and I'm just not positive that they are being used.. I don't mind going through my code and checking but I thought it would be more productive if their was a function that would help me do this quicker?

Dose anyone know of such a thing?

Upvotes: 3

Views: 1417

Answers (3)

chown
chown

Reputation: 52738

If you switch the compiler to LLVM/GCC or just LLVM, then run "Analyze" (CMD+SHIFT+I I think, might be CMD+SHIFT+J) it will put a warning next to any unused variables/ivars/properties.

Upvotes: 2

Ryan
Ryan

Reputation: 518

Product -> Analyze will also show variables that are not read, which sometimes can capture more unused variables.

Upvotes: 3

codelol
codelol

Reputation: 264

You can set the Unused parameter warnings in the Build Settings of your project. Just search "Unused" when looking for the option.

Upvotes: 8

Related Questions