DEV Community

Brian Richardson
Brian Richardson

Posted on

Using GitHub Codespaces on iPad

I only today ran across GitHub Codespaces while lamenting the inability to write code on my iPad, which I've taken to carrying around in place of my larger laptop. Codespaces makes it possible to do some actual development in a coffee shop without lugging around the larger notebook PC. So what is it, exactly?

Codespaces provides both an IDE back-end in the form of a virtual machine, and a web-based version of Visual Studio Code to work on your code hosted on GitHub. You'll need to have a GitHub Team subscription for your user ($4USD/mo). The following steps must be taken before Codespaces will work properly (check the GitHub documentation for further details):

  1. You need to enable Codespaces globally for your repository
  2. You need to set a billing limit for Codespaces

Since Codespaces is a VM, it will bill for usage as per the terms on GitHub website. But, it has a nice feature that by default turns off your Codespace after 30 minutes of inactivity. This will truly get you a pay-as-you-go cloud-based coding environment.

Conclusions

I've compared this to:

  • Amazon Cloud9 (uses its own IDE but requires you to configure all the EC2 components first)
  • CodeAnywhere (has ancient Linux images for their build containers)
  • code-server running on my own VM

The GitHub environment feels very natural on the iPad Pro. I recommend using Safari to load up your Codespace initially, then use the Share function to add your Codespace to your desktop. Using this shortcut to open your Codespace will put it in full screen mode and give you a little extra screen real estate. I also notice that this is the only mode where the Magic Mouse works as expected.

The main reason this works is because it is Visual Studio Code powering the development environment. There is no need to learn a new IDE just to have a cloud-based environment. Once the shortcut is created on your desktop, Codespaces behaves exactly like an iOS native app. Mouse and keyboard work properly. I'd recommend opening your web applications in a separate browser, though by copying the link from the Ports tab in VS Code instead of launching the browser automatically. Doing so will make your debugger unavailable, since the web app opens in the same window as the IDE. You won't get the IDE back until you close the browser.

I fired up the hosted Blazor WASM demo app in .NET 6.0, and very quickly got the application up and running. I was happy to see that WASM runs just fine in Safari, so we don't have to choose between having a native feeling app and a browser that runs WASM. Debugging is a little clunky. I set a breakpoint in the WeatherForecastController, only to find that when I switched back to the browser, it triggered a reload on the data, thus getting into an endless cycle where you can't really debug.

To get around this, remove your breakpoint once you hit it in the debugger. You can still step through, but this time when you switch back to the browser, it the reload won't hit your breakpoint again. It's kind of a pain to keep setting and unsetting breakpoints, but it's a small inconvenience overall.

One last quirk that I recall: the demo .NET 6 application runs by default on HTTPS, and redirects the HTTP port to HTTPS. This will produce a very strange result when you click the local link in the Ports tab: it will go through the GitHub port forward, but then redirect to localhost. This is actually evidence that the application is working properly, since it is redirecting to HTTPS. Since GitHub proxies the web connection, the application thinks it is running on localhost. To prevent this from happening, disable the HTTPS redirection in Program.cs.

If you're like me and have tried every editor in the iOS App Store, and various other cloud-based approaches, I think you'll find this does the trick. It's not seamless, but it's very usable, and will fulfill the stated requirement of hanging out in a coffee shop and coding on your iPad. I am curious about people's experiences with Cloud9 though. I never really got a chance to try it out because I was struggling with my VPC/Subnet configuration. Please comment below if you've used it.

Oldest comments (0)