PrintMate
示例
要运行示例项目,请先克隆仓库,然后从示例目录中运行`pod install`。
try pod 'PrintMate'
需求
Swift 5
安装
PrintMate可通过CocoaPods获得。要安装,只需将以下行添加到您的Podfile中
pod 'PrintMate'
使用
import UIKit
import PrintMate
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Common usage
verbose("Hello World!")
// Custom title
// A separator with a custom title is drawn around the text in the console.
verbose(type: .title("Custom"), "Hello World!")
// Static
MyStruct.sayHello()
// MyStruct conforms to Verbose
MyStruct().sayHello()
// Handling errors
// A separator is drawn around the error in the console so that errors stand out.
do {
try getError()
} catch {
verbose(error)
}
// Superclass
AClass().sayHello()
// Subclass
// Subclass calls super. Notice PrintMate.AClass.swift 15 and PrintMate.BClass.swift 16 is printed to the console.
BClass().sayHello()
}
func getError() throws {
throw MyError("This is my error message.")
}
}
[2019-11-18 03:29:08 PM PrintMate.ViewController.swift ViewController.viewDidLoad() 19] Hello World!
************************************************************** CUSTOM **************************************************************
[2019-11-18 03:29:08 PM PrintMate.ViewController.swift ViewController.viewDidLoad() 24] Hello World!
***********************************************************************************************************************************
[2019-11-18 03:29:08 PM PrintMate.MyStruct.swift MyStruct.sayHello() 15] Hello World!
[2019-11-18 03:29:08 PM PrintMate.MyStruct.swift MyStruct.sayHello() 19] Hello World!
************************************************************** ERROR **************************************************************
[2019-11-18 03:29:08 PM PrintMate.ViewController.swift ViewController.viewDidLoad() 40] MyError(message: "This is my error message.")
***********************************************************************************************************************************
[2019-11-18 03:29:08 PM PrintMate.AClass.swift AClass.sayHello() 15] Hello AClass!
[2019-11-18 03:29:08 PM PrintMate.AClass.swift BClass.sayHello() 15] Hello AClass!
[2019-11-18 03:29:08 PM PrintMate.BClass.swift BClass.sayHello() 16] Hello BClass!
作者
shawnynicole
许可证
PrintMate 采用 MIT 许可证。更多信息请参阅 LICENSE 文件。