hunter heston's profile pic.
Resume

Coding from an iPad

November 12, 2023

image

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:

IMG_0005.jpeg

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”.

IMG_0007.jpeg

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.

IMG_0008.jpeg

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 .)

IMG_0009.jpeg

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:

IMG_0010.jpeg

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.

IMG_0011.jpeg

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.