Getting Rid of Redundant #import Strings

In my Cocoa development, everyone so often includes a header in the source file, so I can use a specific class in it. But then I delete this code from the source file and forget (or don’t want to worry) about deleting the corresponding #import.

Over time, many redundant #import lines accumulate in my source files.

Now I know that these lines do no harm, but is there an easy way to get rid of them automatically? At least this will make the top of every file cleaner;)

+7
source share
2 answers

You have no idea anything in common with the shelf.

1) AppCode JetBrains can help. He is quite young at this time (for example, not even β€œbeta”, but he is publicly distributed), and does not fully understand the structures of inclusions and non-trivial xcode projects and build settings, but he is probably smart enough to handle simpler cases.

2) you could create some scripts to execute what you need. it would be terrible if you already had a project that builds everything using the general build settings. doing it manually is a pain, and usually it’s not very convenient to use in large projects unless you use a high level of automation.

+1
source

There is a tool that does this for C and C ++ , but as far as I can tell, it does not yet support Objective-C. I have applied for a ticket to ask for it.

+2
source

All Articles