#ifdef replacement in the Swift language

前端 未结 17 1725
名媛妹妹
名媛妹妹 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:34

    func inDebugBuilds(_ code: () -> Void) {
        assert({ code(); return true }())
    }
    

    Source

提交回复
热议问题