一个用于创建 .storyboard
文件图形表示的工具。
git clone https://github.com/IBDecodable/IBGraph.git
cd IBGraph
make install
如果尚未安装,请使用 Homebrew 安装 Swiftbrew
brew install swiftbrew/tap/swiftbrew
然后输入
swift brew install IBDecodable/IBGraph
您可以通过 ibgraph help
查看所有描述
$ ibgraph help
Available commands:
help Display general or command-specific help
generate Show graph (default command)
version Display the current version of ibgraph
$ ibgraph
FirstViewController -> ["SecondViewController"]
$ ibgraph --reporter dot
digraph {
0 [label = "FirstViewController"];
1 [label = "SecondViewController"];
0 -> 1;
}
# or ibgraph if reporter defined in configuration file
或者,如果您安装了 graphviz
,则可以打开预览
ibgraph --reporter dot | dot -Tpng | open -Wfa preview
此报告器在 https://dreampuf.github.io/GraphvizOnline/ 上打开图形
$ ibgraph --reporter online
Open url https://dreampuf.github.io/GraphvizOnline/#digraph....
首先使用 dot
报告器。
然后您可以使用 Homebrew 安装 graphviz
brew install graphviz
最后,使用 dot
命令在您的结果文件上启动转换
dot -Tpng MyStoryboards.dot -o MyStoryboards.png
或直接在 ibgraph
启动后
ibgraph --reporter dot | dot -Tpng -o MyStoryboards.png
添加一个 Run Script Phase
以将 IBGraph 与 Xcode 集成
if which ibgraph >/dev/null; then
if which dot >/dev/null; then
ibgraph generate --reporter dot | dot -Tpng -o storyboards.png
else
echo "warning: dot from graphviz is not installed, check how to install here https://github.com/IBDecodable/IBGraph#convert-graph-to-png"
fi
fi
else
echo "warning: IBGraph not installed, download from https://github.com/IBDecodable/IBGraph"
fi
IBGraph 需要 Swift5.0 运行时。请满足以下至少一项要求。
Swift 5 Runtime Support for Command Line Tools
您可以通过从项目根目录添加 .ibgraph.yml
文件来配置 IBGraph。
键 | 描述 |
---|---|
排除 |
要忽略的路径。 |
包含 |
要包含的路径。 |
报告器 |
在 default 、dot 、json 、gml 和 graphml 之间选择输出格式。或 online 以在默认浏览器中打开图形。 |
included:
- App/Views
reporter: "dot"