2

When creating a new Objective-C class, XCode inserts this line into the .h file:

#import <Foundation/Foundation.h>

Instead, I want it to be the following automatic:

@import Foundation;

Where can I set it?

Display Name
  • 4,502
  • 2
  • 47
  • 63

1 Answers1

2

Xcode inserts the imports because this is how it is defined in the "new file templates". Instead of changing those built-in templates you should clone them and make your own, with adjusted import statement.

Look at this answer how to do that: https://stackoverflow.com/a/33743/396578

Community
  • 1
  • 1
Cornelius
  • 4,214
  • 3
  • 36
  • 55
  • The template definition for imports is a bit complicated. Could you also explain how exactly should be the template changed? – Sulthan Feb 06 '15 at 16:39
  • In the case asked above I copy the objective-c file template (`cp -R Objective-C\ File.xctemplate destination/`) and change the #import line in `Empty File/___FILEBASENAME___.m` to @import. – Cornelius Feb 06 '15 at 19:13