#ifdef replacement in the Swift language

前端 未结 17 1866
名媛妹妹
名媛妹妹 2020-11-22 10:35

In C/C++/Objective C you can define a macro using compiler preprocessors. Moreover, you can include/exclude some parts of code using compiler preprocessors.

         


        
17条回答
  •  攒了一身酷
    2020-11-22 11:16

    My two cents for Xcode 8:

    a) A custom flag using the -D prefix works fine, but...

    b) Simpler use:

    In Xcode 8 there is a new section: "Active Compilation Conditions", already with two rows, for debug and release.

    Simply add your define WITHOUT -D.

提交回复
热议问题