Auto import for Xcode

12.7k views Asked by At

Is it possible for Xcode to auto import the frameworks and class headers automatically?

What happens is that every time I build, I will encounter errors due to missing import. I know how to fix, but I felt Xcode can be more intelligent by perhaps giving me an option to "Auto fix imports".

5

There are 5 answers

2
futureelite7 On

You can import a class header into all files automatically by adding it in the .pch file. You will still need to add the frameworks manually though.

4
Stelian Iancu On

At the moment it's not possible to do that. I suppose what you want is something like Eclipse's auto-import, i.e. when you first use a class in code, it auto-imports the package.

You should open a bug report here to let the Apple people know about it.

1
Tom Schulz On

If you install Alcatraz (package manager for xcode) then you can search for "Auto Importer" and you should be good.

0
Moritz On

AppCode has the auto import feature. In my opinion it's not an Xcode replacement, but a welcome addition. It has some killer features like multi caret editing, refactoring that actually works, auto import, tabs that don't drive me nuts, structured code view, etc. Give it a try, you owe it to yourself.

0
Tomasz Bąk On

I know the question is old, but it is good to know that @import was added to LLVM with XCode 5. It gives you features that you wanted. You can find more here and here