Reveal 是一个 iOS UI 调试工具,使用 Reveal 可以在应用运行时方便的查看页面的层级结构,此外,可以在 Reveal 中动态的修改页面中各个控件的背景色、字体大小(可以显示字体的控件,如 UILabel)等样式,并且不需要重新运行程序就可以在 Reveal 中实时看到修改后的效果。
在Reveal中修改布局参数直接生效, 在reveal预览和模拟器上都能看到效果。 而Xcode需要重新编译运行, Reveal调试布局更加方便。
苹果更新到Swift3.0后,配置脚本参数也变了。
一、 安装Reveal;
二、 运行Bash窗口, 执行touch ~/.lldbinit和open ~/.lldbinit
三、 添加文件内容并保存(API更新了,试了很多次);
command alias swift_reveal_load_sim expr dlopen("/Applications/Reveal.app/Contents/SharedSupport/iOS-Libraries/libReveal.dylib", 2)
command alias swift_reveal_load_dev expr dlopen(Bundle.main.path(forResource: "libReveal", ofType: "dylib")!, 2)
command alias swift_reveal_start expr NotificationCenter.default.post(name: NSNotification.Name(rawValue: "IBARevealRequestStart"), object: nil)
command alias swift_reveal_stop expr NotificationCenter.default.post(name: NSNotification.Name(rawValue: "IBARevealRequestStop"), object: nil)
四、在AppDelegate.swift中添加断点并设置swift_reveal_load_sim
五、运行Swift app工程, 在Reveal里修改参数后模拟器和Reveal都能看到变化, 在Reveal里的修改并不会修改Xcode工程的storyboard文件。
其实Reveal还有个作用, 那就是反编译别人APP的布局, 暂时还没试过