条件编译

229 阅读1分钟

在bulid settings中搜索swift complier - custom, 找到Active Compilation Conditions, 展开可以看到Debug 后面为DEBUG

// debug模式
# if DEBUG

// release模式
#else 

#endif

自定义条件:
第一种方法:在bulid settings中搜索swift complier - custom, 找到Active Compilation Conditions, 展开可以看到Debug 后面为DEBUG,然后 空格+标记名,例如 DEBUG CUSTOMC

第二种方法:在bulid settings中搜索swift complier - custom, 找到Other Swift Flags展开在Debug后面添加-D 标记名