swift中的print
2016-12-08 00:00
218 查看
摘要: 自定义打印
一、自定义print
1.当前路径(String):let filePath = #file
2.当前函数(String):let funcName = #function
3.当前行号(Int):let lineNum = #line
4.当前列号(Int):let columnNum = #column
5.xf_print():
func xf_print<T>(message : T, file : String = #file, funcName : String = #function, line : Int = #line, column : Int = #column) {
let file = (file as NSString).lastPathComponent
print("\(file) : [\(funcName)] (\(line)行\(column)列) - \(message)")
}
此处应作为全局函数,供外界使用。
二、去掉Xcode中多余的打印
1.Product->Scheme->Edit Scheme(或者Command + shift + <);
2.Run->Arguments->Environment Variable;
3.点击“+”,Name栏输入OS_ACTIVITY_MODE,Value栏输入disable
注:以上仅为自己学习随笔,如有错误欢迎指正!转载请注明出处,谢谢!。
一、自定义print
1.当前路径(String):let filePath = #file
2.当前函数(String):let funcName = #function
3.当前行号(Int):let lineNum = #line
4.当前列号(Int):let columnNum = #column
5.xf_print():
func xf_print<T>(message : T, file : String = #file, funcName : String = #function, line : Int = #line, column : Int = #column) {
let file = (file as NSString).lastPathComponent
print("\(file) : [\(funcName)] (\(line)行\(column)列) - \(message)")
}
此处应作为全局函数,供外界使用。
二、去掉Xcode中多余的打印
1.Product->Scheme->Edit Scheme(或者Command + shift + <);
2.Run->Arguments->Environment Variable;
3.点击“+”,Name栏输入OS_ACTIVITY_MODE,Value栏输入disable
注:以上仅为自己学习随笔,如有错误欢迎指正!转载请注明出处,谢谢!。
相关文章推荐
- Swift的print不换行打印的方法
- Swift print 小技巧
- Swift的print不换行打印的方法
- Swift的NSLog和print的区别
- Swift的print不换行打印的方法
- Swift减少print函数的耗费
- Swift的print不换行打印的方法
- Swift print
- swift print Double
- swift之格式化字符串、print格式化打印、debug调试
- NSLog/PrintLog的使用技巧(Objective-C/Swift)
- Swift 变量名、print的基本用法
- Swift中Debug和Release两种状态下print()函数调试切换
- Swift 3: let sortedNumbers = numbers.sort { $0 > $1 } print(sortedNumbers) 结果显示为()
- swift变量输入使用print
- iOS Swift print了解和不换行
- Swift备忘 - 自定义日志记录中的print与NSDate
- iOS:Swift自定义print
- "print" in Swift
- Swift: print() vs println() vs NSLog()