I sometimes see multiple projects at the same time in my work, and on average I open the terminal about once a day and hit the pod-install command. This article is a tip that makes it easier for iOS app developers to work with the CocoaPods command pod-install. Xcode has a function called Behaviors, which allows you to set and add various actions and events. Using that function, create a shortcut key that automatically opens the terminal, moves to the specified directory, and hits the pod-install command.
Xcode12 (I think it works with Xcode11, but it has not been verified) Cocoapods
Download Script
#!/bin/sh
osascript <<END
tell application "Terminal"
if not (exists window 1) then reopen
activate
do script "cd `pwd`; pod install" in window 1
end tell
END
Confirmation of authority
$ ls -l Pod-Install.sh
-rw-rw-r--@ 1 yasuradodo staff 158 Sep 19 19:40 Pod-Install.sh
If you do not have execute permission, grant execute permission x
$ chmod u+x Pod-Install.sh
Check permissions again
$ ls -l Pod-Install.sh
-rwxrw-r--@ 1 yasuradodo staff 158 Sep 19 19:40 Pod-Install.sh
shift + command + p
. Now, you can automatically execute pod-install at any time with the shortcut registered on Xcode. At the end, this time it was only pod-install, but it can support various things such as Carthage, SourceTree, SwiftLint, etc. and improve work efficiency. If you have any other useful ways to use Behaviors, please let me know: pray: Referenceshttps://medium.com/@abhishekbedi/never-type-pod-install-again-ever-eb55386eef59 https://github.com/JeaSungLEE/Awesome-Xcode-Behaviors
Recommended Posts