Coding from an iPad
November 12, 2023
Coding from an iPad is pretty doable today.
A few things make coding from an iPad accessible to a lot of people today. It doesnāt even require that much to get going.
You need:
- An iPad - Iām using the 4th generation iPad Air.
- A GitHub account - Used for GitHub code spaces.
- A keyboard case - You could use the on screen keyboard, but I wouldnāt recommend it.
Overview
We are going to use GitHub codespaces on our iPad to build a hello world application in Go. This will be a quick guide and only assume some prior knowledge.
Letās get started.
Setup your GitHub repository
Go to GitHub.com and create an account if you donāt already have one. Once you have your account, create a repository. Make sure to select the āinitialize my repo with a readmeā option since we can initialize a repository on our iPad.
You should see something like this at the end:
Open a codespace from your repository
Visit https://github.com/codespaces and click āNew codespaceā. Then select the repository you just created and click āCreate codespaceā.
Give it a minute to finish setting everything up and you should find yourself looking at a VSCode text editor with a fully fledged terminal ready to go.
Good to go
At this point you can get busy installing whatever language tools you want and coding/testing/debugging as if you are working directly on a Linux machine.
There are a few other things you can do to make it nicer. Letās continue.
Hello World - Go
Iām going to setup and run a hello world program in Go.
Check that go is installed
Run:
go version
Which should output:
go version go1.21.3 linux/amd64
Okay, we have go. Let start coding.
Go Project Setup
Create a src
directory:
mkdir src
Move to your new directory:
mv src
Create a main.go
file:
touch main.go
Open your new file:
code src/main.go
Okay, you should now have a src
directory with a single open file called main.go
. Looking like this. (Inspect your local folder structure with this command tree .
)
Note: youāll probably notice the āDo you want to install the recommended āGoā extensions from the Go Team at Google for the Go languageā. I would recommend you install them, but itās optional.
Another quick command youāll need to run is go mod init path/to/your/src
For me it was:
go mod init workspace/ipad-codespace/src
Code and run
Paste the hello world code bellow into your main.go
file.
package main
import "fmt"
func main() {
fmt.Println("Hello, World!")
}
Now run your code:
go run src/main.go
Your output should be:
Hello, World!
On my screen it looks like this:
Finishing up
Letās commit our project and push it up to GitHub.
# stage the two files we created
git add src/main.go go.mod
# turn them into a commit with a message
git commit -m "initial commit - hello world"
# push that commit up to githubs servers
git push origin main
āInstallingā your codespace
It would be nice to access this codespace with an app icon on our Home Screen. So letās do that. Click the share button in the url bar of your codespace.
Give it a name and now you will be able to access this codespace with a single click.
Conclusion
You can follow the same process for setting up any number of repos or coding environments. Overall itās a really pleasant experience if you have a good iPad with a solid keyboard case. I wouldnāt drop my laptop just because this is available.
There are a lot of times when I need to do just a little bit of coding. Or Iām working on a personal project. Something I wouldnāt want to lug my laptop around to work on. But that I would work on if I have a spare moment, my iPad, and an internet connection.
Thanks for reading. If you notice any errors or have any questions please send me a message.