.pch file usage

前端 未结 2 1744
慢半拍i
慢半拍i 2021-02-06 11:02

What is the importance of .pch file and what is the significance of\"#ifdef OBJC\"?

Also, where do we define parameters like \"#ifdef IS_PRODUCTION\" wh

2条回答
  •  执念已碎
    2021-02-06 11:34

    The .pch file allows you to avoid importing common files like UIKit.h and Foundation.h. If you have those files imported in the .pch, your own classes don't need to import them.

    The significance of #ifdef OBJC is so that you don't import headers containing objective-c code if you don't have the compiler set to build objective c code (hence avoiding lots of compiler errors).

    You define parameters such as IS_PRODUCTION inside the target's build settings. I do it usually in "other C flags".

提交回复
热议问题