Create your own shortcuts in Xcode to eliminate the hassle of pod install

Introduction

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.

Development environment

Xcode12 (I think it works with Xcode11, but it has not been verified) Cocoapods

setup

1. Prepare Script

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

2. Grant execution authority

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

3. Create Custom command in Behaviors of Xcode

Screen_Shot_2020-09-26_at_18_30_48.png

Register your favorite key for the shortcut. I chose 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: References

https://medium.com/@abhishekbedi/never-type-pod-install-again-ever-eb55386eef59 https://github.com/JeaSungLEE/Awesome-Xcode-Behaviors

Recommended Posts

Create your own shortcuts in Xcode to eliminate the hassle of pod install
How to create your own annotation in Java and get the value
Utilization of Talend component (5) Create your own component
Create your own dialect to convert line feed code to line feed tag in Thymeleaf3
Contemplation: How to take advantage of functional interfaces in your own functions (java)
How to install Docker in the local environment of an existing Rails application [Rails 6 / MySQL 8]
I tried to create a log reproduction script at the time of apt install
Install multiple submit buttons in Rails View to get the value of the pressed button
Understand the characteristics of Scala in 5 minutes (Introduction to Scala)
How to install the root certificate of Centos7 (Cybertrust)
Mandels to create an image of the Mandelbrot set
[Rails] What to do if you accidentally install bundle in the production environment in your local environment
How to read your own YAML file (*****. Yml) in Java
Install by specifying the version of Django in the Docker environment
[Forge] How to register your own Entity and Entity Render in 1.13.2
How to create a placeholder part to use in the IN clause
Create a method to return the tax rate in Java
Set the time zone in the JVM of your Azure application
How to derive the last day of the month in Java
[Rails] Where to be careful in the description of validation
Create more Tabs and Fragments in the Fragment of BottomNavigationView
Use your own classes in the lib directory with Rails6
802.1X authentication to the network of Bonding setting in CentOS7
[Note] What to do if bundle install in Chapter 3 of the rails tutorial is not possible