开发者

Objective-C #import a whole directory

Hey guys, sure hope you can help me.

I've got around 50 Model-Classes stored in a seperate Folder (not only a gro开发者_运维百科up) and I really don't want to write an #import for each of these classes.

Is there a way to import a whole directory?

I know it's possible within other programming languaged and perhabs I simply used wrong syntax.

Plz help me! greets Infinite


#import is just a variant of #include. They don't allow to specify a whole directory.

You will have to specify each of your 50 header files.

You can generate that list with bash:

cd myfolder ; printf '#import "%s"\n' *.h > ../myheader.h


As a possible workaround you can import all of them in separate header(e.g. MyImports.h) and import only it whenever you need.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜