UI Bug with Xcode's invisible characters in documentation comments

Feedback number: FB12128126

I like to display invisible characters in my text editors/IDEs because I want to know if the spaces I’m seeing are spaces or tabs. I also like to be able to tell immediately if I’m seeing multiple spaces or not.

Here is an example of what that looks like. Notice the grey dots between words. screenshot of xcode showing invisible spaces rendered visible

In Xcode, you can find this in the Editor menu labeled as Invisibles.

screenshot snippet of the editor menu in xcode showing the invisibles item

Today I noticed that when using documentation comments, the invisibles are misaligned and lay on top of the characters instead of between them. I submitted a feedback, but I’m not sure it will ever be addressed so I wrote this post in case someone else runs into the same thing.

screenshot of xcode showing invisibles in documentation comment misaligned layout

misaligned invisibles in documentation comment.

How to list installed apps on a iOS simulator

This lists apps from a named simulator, converts to json, then finds non-apple apps.

xcrun simctl listapps "iPad Air (5th generation)" \
| plutil -convert json -o - -- - \
| jq '. | keys | .[] | select(. | startswith("com.apple") | not)'

This requires that you know the name of your simulator and have jq installed.

You can also replace the device name with booted if you want, but I prefer to use the name of the simulator.

Here are the docs for using a simulator name versus booted for simctl.

For subcommands that require a <device> argument, you may specify a device UDID
or the special "booted" string which will cause simctl to pick a booted device.
If multiple devices are booted when the "booted" device is selected, simctl
will choose one of them.

Note: as far as I can tell, there are no docs for listapps or even anything stating its existence in the man page for simctl.

How to see git authors per line in Xcode

In my previous life I used a tool with VSCode called GitLens. What it does is show you what the last git commit for a selected line was. When you hovered over the greyed out text to the right of your code line, you’d get a little popover with more info about the commit. This is a really handy tool for quickly figuring out who made what change and when.

GitLens screenshot

Today I work mostly in Xcode and sadly Xcode doesn’t have this extension nor support this feature. It does however have something that shows you who changed each line and a brief commit message to try to provide some insight.

Screenshot of Xcode showing it's author view and popover for git commit information.

You can access this with ctrl + shift + cmd + A or find it in the Editor Menu for Xcode.

Xcode Editor Menu showing the Authors menu item and shortcut.

I'm working on an iOS app

I’m working on an iOS app and I’m getting so close to releasing the 1.0. I was looking at App Store Connect and noticed that I needed screenshots and I remembered that Fastlane has the ability to automate screenshot creation.

Pretty cool I think. So I go through the process of setting up and starting to work on the UI Tests that need to run in order to trigger the screens I want to show and then it hits me.

The app I’m working on uses MusicKit and unfortunately the Xcode Simulators aren’t able to really do anything with MusicKit i.e. they can’t search or play music which is kind of a big deal. This hadn’t been much an issue during development because I could just run the app on my phone.

From what I can tell I will not be able to use Fastlane to automate this screenshot creation because it relies on using simulators for running the UI Tests that would then capture screenshots. What a bummer (though I sure hope I’m wrong!).

Fortunately I found another resource from Benoit Pasquier that might make it possible for me to use UI Tests to automate screenshots to some degree. It won’t be quite as extensive, but my wife has a regular sized iPhone and I have a big one so at least I’ll have two sets of screenshots. No luck on the iPhone SE size. Hopefully that isn’t a dealbreaker, but we’ll see. This is all very new to me.

This is my first time writing (re: rambling) about this app and if you’d like to hear more or be invited to the TestFlight, feel free to comment on this post or shoot me an email at nick_kaczmarek@icloud.com.

Cheers πŸ₯‚

Xcode GPG not found issue

If you use GPG and Xcode you may have run into this error.

Xcode error message saying GPG cannot be found

From what I can tell if doesn’t really matter and you can still commit just fine (in the terminal if you want to use GPG), but it was annoying me. So I went spelunking and found this post on GitHub. In the post the author shares a git config command we can use to solve the issue.

git config --global gpg.program $(which gpg)

Run this in your terminal and then when you create a project in Xcode, the warning should go away. Expect that you’ll need to enter your GPG password (if you have one) on the next project creation.

For reference, here is the gist I followed to set up my GPG key for macOS.

TIL: Xcode has the ability to split editors vertically

I have used VSCode for much of my career (for historical .NETy reasons) and really like its ability to split editor panes. Particularly the ability to split horizontally and vertically. I was bummed when moving to Xcode and found I wasn’t able to do this…Until now!

How to do split editor vertically in Xcode

  1. Open Xcode (seems like it has to be a project, not a playground)
  2. Go to File -> New -> Editor Below (ctrl + option + cmd + T) macOS Xcode menu with Editor Below highlighted

This is very exciting, but I look forward to when other editors support the VSCode feature of dragging those pane corners more than one direction at a time. (VSCode allows you to grab at the corner of two panes and drag horizontally, vertically, or diagonally all in one motion while Xcode and Nova only allow one direction per click).