iOS Prefix.pch best practices

后端 未结 4 935
既然无缘
既然无缘 2020-11-28 18:45

I have seen many developers that add various convenience macros to the Prefix.pch of their iOS projects.

What do (or don\'t) you recommend adding to the iOS Prefix.p

4条回答
  •  清酒与你
    2020-11-28 19:31

    Ewww… don't put macros in a .pch file! A .pch file is, by definition, a project specific precompiled header. It really shouldn't be used beyond the context of the project and it really shouldn't contain anything but #includes and #imports.

    If you have some macros and such that you want to share between headers, then stick 'em in a header file of their own — Common.h or whatever — and #include that at the beginning of the .pch.

提交回复
热议问题