參考: https://tokhirjon.medium.com/effortlessly-format-your-swift-code-on-save-in-xcode-a6dac425ba6c 如果没有brew 需要提前homebrew 以下是以安裝好brew的前提下進行 安装swiftformat-for-xcode ``` brew install --cask swiftformat-for-xcode ``` 網站中的第二步找不到 但不做也能成功 安裝完後在啟動台會有SwiftFormat For XCode 點開後會有步驟 如果看不懂就接下去做 以下根據Mac版本不同要改的地方不一樣 擇一就行 ``` 打開系統設定=>隱私權與安全性=>輔助功能=>XCode來源編輯器選擇SwiftFormat 打開系統設定=>一般=>延伸功能=>XCode來源編輯器選擇SwiftFormat ``` 在系統設定=>鍵盤=>右側的鍵盤快速鍵=>左側的App快速鍵=>右側按+號新增=>應用程式選擇XCode 選單標題輸入 這邊沒辦法複製 智障Mac ``` Editor->SwiftFormat->Format File ``` 再輸入格式化的快捷鍵 因為要和保存連動 所以點擊一下輸入框 並按下command + s 按下完成後 重新啟動XCode
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up