<h1 id="toc_0">前言</h1>
<p>前几天看了大神罗琦的直播,介绍<a href="https://github.com/venmo/synx">synx</a>工具的使用。于是在空闲之余,安装使用synx.</p>
<p>总所周知,在iOS项目中新建组目录(command + option + n)是不会生成相应的文件夹的,使用synx工具就能够生成与iOS项目结构相同的目录。</p>
<h1 id="toc_1">安装</h1>
<p>根据synx官方介绍,使用以下命令安装</p>
<pre>$ gem install synx</code></pre>
<p>或许是因为本人Mac系统是10.11,死活也安装不上。于是开启各种搜索,找到了解决方法: </p>
<pre>$ sudo gem install -n /usr/local/bin synx</code></pre>
<h1 id="toc_2">使用方法</h1>
<p>在终端中输入以下命令:</p>
<pre>$ synx /Users/Siri/Documents/XToDo/MYCS/MYCS.xcodeproj</code></pre>
<p>输出信息:</p>
<pre>Syncing files that are included in Xcode project...
Frameworks/ (excluded)
MYCS/
Assets.xcassets
Info.plist (build settings amended: INFOPLIST_FILE)
Classes/
Category/
UIImage/
UIImage+Color.h
UIImage+Color.m
UIImage+blur.h
UIImage+blur.m
UIScreen/
。。。。。。。中间位省略内容。。。。。。。。。
ThirdParty/
FDFullscreenPopGesture/
UINavigationController+FDFullscreenPopGesture.h
UINavigationController+FDFullscreenPopGesture.m
Supporting Files/
main.m
LaunchScreen.storyboard/
Base
MYCSTests/
Info.plist (build settings amended: INFOPLIST_FILE)
MYCSTests.m
MYCSUITests/
Info.plist (build settings amended: INFOPLIST_FILE)
MYCSUITests.m
Pods/ (excluded)
Products/ (excluded) </code></pre>
<h1 id="toc_3">使用APPleScript</h1>
<p>每次启动终端,输入synx命令挺麻烦的。所以为了更加快捷方便,直接使用Applescript来创建小程序。</p>
<p>APPleScript代码如下:</p>
<pre>tell application "Terminal"
display dialog "同步工程项目" buttons {"确定"} default button "确定" with title "提示" with icon note
if button returned of result = "确定" then
do shell script "/usr/local/bin/synx /Users/Siri/Documents/XToDo/MYCS/MYCS.xcodeproj"
end if
quit
end tell</code></pre>
<p><strong>注意:</strong>修改项目的xxxx.xcodeproj路径。</p>