{ CocoaPods }

  • Preprocessor Macros in Pods

    | /

    As mentioned earlier, we can inject macros into Pods from the outside by modifying the Podfile. You can refer to this article Inject TEST macros into Pods.

    Sometimes there are some macros that are expected to be used inside the Pods library we wrote ourselves.

    A common practice, just like ordinary business code, define a macro definition header file, and then import.

    But sometimes there are such scenarios, such as logging or providing some externally exposed APIs, you need to provide the version of the current library.

  • Inject TEST macros into Pods

    | /

    When we develop iOS applications, we often use CocoaPods for third-party library management.

    In addition to external third-party libraries, it is common for CocoaPods to be used as a library management tool for individuals or companies.

    We usually use macros such as DEBUG for environment-sensitive branch compilation.

    CocoaPods provides DEBUG macro injection by default to facilitate our local debugging.

    However, in actual development projects, in addition to using the DEBUG macro to identify local debugging, macros such as TEST or QA are also used to identify the test build package.

    At this time, we expect that the library in Pods can also inject TEST macros on demand.