DotzuX iOS 调试小工具 项目简介
DotzuX 是一款 iOS 调试小工具。预览安装CocoaPodsplatform :ios, '8.0'
use_frameworks!
target 'YourTargetName' do
pod 'DotzuX', :configurations => ['Debug']
endCarthagegithub "DotzuX/DotzuX"警告:不要在正式发布版中(比如发布到AppStore)导入DotzuX.framework,因为DotzuX内部使用了Apple的私有API,并且DotzuX使用了hook,可能会带来不可预知的风险。阅读这篇集成指南,了解如何仅在Debug环境下导入DotzuX.framework。使用Swift//Step 1.
#if DEBUG
import DotzuX
#endif
//Step 2.
#if DEBUG
DotzuX.enable()
#endif
//Step 3.
public func print<T>(file: String = #file, function: String = #function, line: Int = #line, _ message: T, color: UIColor = .white) {
#if DEBUG
swiftLog(file, function, line, message, color)
#endif
}Objective-C//Step 1.
#ifdef DEBUG
@import DotzuX;
#endif
//Step 2.
#ifdef DEBUG
[DotzuX enable];
#endif
//Step 3.
#ifdef DEBUG
#define NSLog(fmt, ...) [DotzuX objcLog:[[NSString stringWithUTF8String:__FILE__] lastPathComponent] :NSStringFromSelector(_cmd) :__LINE__ :(fmt, ##__VA_ARGS__) :[UIColor whiteColor]]
#else
#define NSLog(fmt, ...) nil
#endif更多高级用法,请查看示例代码。注意:如果项目使用了Swift和Objective-C混编,请小心使用Other Swift Flags和Preprocessor Macros,可以参考这里。TODO单元测试 (Unit Testing)
use_frameworks!
target 'YourTargetName' do
pod 'DotzuX', :configurations => ['Debug']
endCarthagegithub "DotzuX/DotzuX"警告:不要在正式发布版中(比如发布到AppStore)导入DotzuX.framework,因为DotzuX内部使用了Apple的私有API,并且DotzuX使用了hook,可能会带来不可预知的风险。阅读这篇集成指南,了解如何仅在Debug环境下导入DotzuX.framework。使用Swift//Step 1.
#if DEBUG
import DotzuX
#endif
//Step 2.
#if DEBUG
DotzuX.enable()
#endif
//Step 3.
public func print<T>(file: String = #file, function: String = #function, line: Int = #line, _ message: T, color: UIColor = .white) {
#if DEBUG
swiftLog(file, function, line, message, color)
#endif
}Objective-C//Step 1.
#ifdef DEBUG
@import DotzuX;
#endif
//Step 2.
#ifdef DEBUG
[DotzuX enable];
#endif
//Step 3.
#ifdef DEBUG
#define NSLog(fmt, ...) [DotzuX objcLog:[[NSString stringWithUTF8String:__FILE__] lastPathComponent] :NSStringFromSelector(_cmd) :__LINE__ :(fmt, ##__VA_ARGS__) :[UIColor whiteColor]]
#else
#define NSLog(fmt, ...) nil
#endif更多高级用法,请查看示例代码。注意:如果项目使用了Swift和Objective-C混编,请小心使用Other Swift Flags和Preprocessor Macros,可以参考这里。TODO单元测试 (Unit Testing)