On Xcode's dilapidated state, ergonomics and keyboard shortcuts
Xcode a lot. Every day, in fact. This is not so surprising if you know I write software for Apple platforms professionally. If you've spoken to developers who need to spend time in Xcode for serious amounts of time, you might have heard about its quality. Or rather, its lack of quality. It's a whole topic in its own right, so I'll keep that for another day.
As software developers, we spend a lot of time at our computers and often wreak havoc on our bodies while doing so. Over the years, I have had to adapt how I use computers. I started feeling aches and pains because of improper posture and, frankly, simply too much screen time. It resulted in sore shoulders, a stiff neck, painful wrists, and cramped hands... If you feel any of these symptoms, please acknowledge them immediately. They are the tell-tale signs of impending damage.
Thanks for reading Function Pointer Newsletter! Subscribe for free to receive new posts and support my work.
I've found there are only two things you can do to address injuries caused by repetitive strain: (1) improve the ergonomics of the input devices you use and (2) avoid the most invasive input device of all: the mouse. You'll still always need the mouse, but try to minimize your reliance on it.
On input device ergonomics
My wrists started flaring up first. How repetitive strain injury creeps up on you is insidious. At first, it manifests as mild soreness that subsides after resting. Ignore it for too long, however, and the pain will push to the foreground more permanently. Only a drastic behavior change will remedy the situation.
I "fixed" the mouse situation early on by switching to a trackball mouse. It required some experimentation, where I moved from thumb-operated to index-finger-operated devices and back to thumb-operated, which is where I landed. Logitech has always offered a select set of accessibility-focused input devices, and I've settled on MX Ergo. It's not a sexy device by any stretch of the imagination, but in my experience, nothing else has come close to helping me stay on top of my wrist pain.
In the last year or so, I also started using Apple's Magic Trackpad. I noticed that the extensive use of thumb-operated trackballs also has its issues. In my case, it induces a mild soreness in - you guessed it - the thumb! It would be better to just the mouse less frequently, but as you'll notice, certain software vendors make this particularly hard.
I like Apple's trackpad a lot. It features a large surface area, and its accuracy is second to none. Over a typical working day, I will switch between the trackball and trackpad to spread the strain. Two-finger swiping works nicely for me on the trackpad, too; it's much less tiring than fingering the trackball's scroll wheel all day. Most of my scrolling action comes in during code reviews; coding, not so much.
In terms of keyboards, I still use my Kinesis Freestyle2 split ergonomic keyboard every day while working from home. It's hideous, really. Think wires and black plastic. I place the two halves of the device away from each other and turn them somewhat askew. This placement accommodates the natural resting position of my hands. The divide along the middle of the keyboard also reinforces my touch-typing skills. You can't pick at keys you shouldn't be because they'll be on the wrong side of the device ;-).
I simply settle for my MacBook Pro M1's built-in keyboard when working away from my home office. As I generally work on-location 1 or 2 days a week, this hasn't caused any issues for me so far. The type of work on location with the client is also different; it is more oriented toward personal interaction, with less dedicated screen time.
In recent months, I also added a wrist pad to the mix, as I was experiencing issues with how my hands were angled without it. The pad removes any pinch points by lifting the wrists off the desk and bringing the forearms in line with the keyboard. Some keyboards have built-in wrist supports, so it might be something to look out for if you decide to shop for an ergonomic keyboard.
The importance of keyboard input
Optimizing keyboard input is important because proper keyboard use is less invasive than mouse usage. I think the less you need to fall back on a pointing device to get work done, the better. And this is where good software tooling comes into play.
Professional software developers, writers, or any other knowledge worker who spends significant time at a keyboard are best served if the software they use is tailored toward keyboard input. Not just mouse or touch input. Keyboard shortcuts and commands are essential to productivity and should not be ignored.
Xcode and macOS
This is where my daily tool, Xcode, needs to catch up. Entirely in line with macOS, it doesn't care much about keyboard navigability. Let me give you a few examples of issues I've been struggling with for years:
- Dialogs with buttons. The return key often triggers the default action button, but only sometimes. If you've used Windows in the past, you'll know that the tab key should cycle the selection ring over the available buttons, not so (with default settings) in macOS. Granted, you can enable this setting if you know where to look in macOS's accessibility settings. But even with this option enabled, it doesn't always work. It's infuriating.
- Dock icons. How do you even get to the dock without a mouse? I honestly don't know.
- Menu bar. Ditto.
If I gave it more thought, I'm sure I could come up with a long list of other issues. I'd rather not dwell on it right now, though, so let's move on :-).
Let's turn our attention back to Xcode for a moment. I use it for 8 hours or more daily, and I hate it. Isn't that sad? Its keyboard support isn't the sole reason for these hard feelings, but it matters a lot to me, as you can tell. So what gives?
The editor view is the core of the experience; thankfully, this works as you expect it to. It displays text, there's a cursor, and you type stuff. Perfect! But what about the panels to the left and right, the toolbar along the top, or the debug panel along the bottom? How do you get there without shoving the mouse cursor around? You can learn a few keyboard shortcuts that help you achieve some of the more essential tasks, like building, running, cleaning, stepping into and over code while debugging, jumping to files, etc. Learning these by heart will get you far, but more is needed... These panels I spoke of are impossible to work with without a mouse. Yes, you can jump into them with Cmd-1, Cmd-2, Cmd-n, but once in there, you're stuck. These panels are extremely important, though. They list the project's file structure, search results, breakpoints, and stack trace. Everything revolves around the side panels, yet they're close to inaccessible by the keyboard.
Suppose you've used other popular code editors like VS Code or any of the JetBrains offerings. In that case, you will be familiar with handy things like Find usages, Find implementation, and the like. Does Xcode offer these? In theory, yes. But do they have any real utility? Not quite. By default, these functions require mouse interaction while you press some modifier key and then select the option from a dropdown menu. It's all very clunky, but luckily, these can be remapped in the settings. Good. You've remapped them. But half the time, you'll be disappointed to find these essential navigation functions simply don't work correctly. They either bring you to the wrong place or, often, nowhere at all.
I know why Find Usages is so severely broken in Xcode. It's because it's built on top of Apple's lackluster compiler infrastructure and indexer. It's constantly trying (and failing) to catch up with the project's actual state. There is also something wrong with the build cache. It will always be in a non-consistent state, still containing references to classes or methods that no longer exist or have been moved to a different place, resulting in the aforementioned flaky performance regarding project navigation.
Augmenting Xcode
Sadly, I still need Xcode if I want to do my job. To date, no alternatives offer the same integrated development experience. JetBrains discontinued AppCode in 2022, an alternative to Xcode that never quite worked right again after Apple switched to Swift from Objective-C. You can install plugins for VS Code, but I need to invest more time to know if it's a worthy alternative. The feeling I get about this from what I read online is probably "no" or "not yet." So, for the time being, I'm stuck with Xcode.
There are things I've found, however, that improve the situation. Mapping frequently used commands to sane keyboard shortcuts is one. And the side panel situation? Ugh. That's a tough one. I just deal with it. Sometimes, hitting the tab key does the trick; the arrow keys also work from time to time, and in the end, I will mouse over to whichever button needs clicking. You can't win them all.
I initially came here to write about Vim and Vim mode in Xcode! Yes, Vim mode, of all things. It's been the greatest single feature to improve my Xcode experience so far, and I grow increasingly fond of it as time progresses. It enables me to reduce my mouse usage and, in turn, reduce my RSI. It speeds up the code authoring process because less time is wasted pushing a mouse cursor around.
It's been great all around, and I'd like to tell you all about it. But let's do that next time because this post is running long :-).
Member discussion