Reputation: 4912
I have seen this question, but the answer doesn't seem to be valid in Xcode 7. At least I can't find it.
Can anyone tell me where can I tell the compiler to notify me about unused functions/parameters/values ?
Upvotes: 47
Views: 31238
Reputation: 5225
2022 Update | Swift
Those who are looking for a way to remove unused code from Swift project, it can be done easily using Periphery.
Periphery is a tool to remove unused code from Swift projects. It can detect unused function, struct, class, protocols etc.
Its very easy to use. You can get step by step guide here :
Remove Unsed Code from iOS Swift Project
Upvotes: 2
Reputation: 3885
For those who are seeking a solution for Objective-C
codebase like me, try this script by @nst. It analyzes the mach-o files.
Upvotes: 1
Reputation: 351
To check the unused functions and variables you can also use the following scripts-
Upvotes: 8
Reputation: 1287
In left side select Project and in Build Settings
Unused functions, parameters, and values
Other Warning Flags to -Wall -Wextra -Weverything
Upvotes: 14
Reputation:
Xcode has a number of settings you can enable to warn you about things like unused functions, parameters, and values.
You can also easily enable strict warnings by setting your Other Warning Flags to -Wall -Wextra -Weverything
.
Another option for detecting unused code is by using Code Coverage.
Upvotes: 79