實(shí)現(xiàn)打印:
func printLog(message: T,
file: String = __FILE__,
method: String = __FUNCTION__,
line: Int = __LINE__)
{
#if DEBUG
print("\((file as NSString).lastPathComponent)[\(line)], \(method): \(message)")
#endif
}
新版本的 LLVM 編譯器在遇到這個(gè)空方法時(shí),甚至?xí)苯訉⑦@個(gè)方法整個(gè)去掉,完全不去調(diào)用它,從而實(shí)現(xiàn)零成本。