Swift 常见的编译符号

220 阅读1分钟

swift:

#file : String 包含这个符号的文件路径
#function : String 包含这个符号的方法名称
#line : Int 这个符号出现的行号
#column : Int 这个符号出现的列号

objective-c:

__FILE__ : NSString 包含这个符号的文件路径
__cmd : NSString 包含这个符号的方法名称
__LINE__ : Int 这个符号出现的行号
__COLUME__ : Int 这个符号出现的列号

用法参考:

static func error<T>(_ msg: T, _ file: NSString = #file, _ fn: String = #function, _ line: Int = #line){

        _log("ERROR", msg, file, fn, line)

 }