Making Xcode Feel Like HomeMay 5, 2015
When it comes to software development, I am most at home in my favorite text editor, Sublime Text. However, the development tools provided in Xcode for iOS development make it a vital part of the app development process. As such, I am on a never-ending quest to make Xcode feel more like home.
Where to Begin?
Alcatraz provides an interface right in Xcode for searching for and installing plugins, managing color schemes, and even downloading new project templates.
A Fresh Coat of Paint
Step one in my quest for a more homey Xcode was to acheive visual continuity between the tools I use every day. This means installing the same color scheme I use elsewhere (Sublime Text, zsh). My color scheme of choice is Tomorrow Night – Eighties. Luckily Alcatraz has it available to install for Xcode.
Unfortunately, now that we have a dark color scheme installed, the IBeam cursor becomes nearly invisible when over an editing pane. I haven’t found a great way to fix this, other than providing Xcode with a different cursor. I found this cursor to look pretty nice. Copying that cursor to
and restarting Xcode will cause Xcode to pick up the new IBeam cursor. Note however, any time you update Xcode this change will be overwritten.
Plug It In
So now Xcode has a shiny new coat of paint, but what about bending it to fit the workflow we are used to? For that we need a few more plugins. Three that I have found useful are GitDiff, Xcode-beginning-of-line, SCXcodeMinimap, and Clang Format.
Xcode-beginning-of-file is just a simple plug in that makes my navigation around the editor pane and little easier for me. GitDiff provides useful gutter marks showing me what has changed in the current file, something I have grown accustomed to with the Modific plugin for Sublime Text.
And of course, we would not be at home without the minimap. While it may seem silly at first, I find the sublime minimap provides a great enhancement over the traditional scrollbar.
Unfortunately, after some use, it appears that SCXcodeMinimap has some issues where scrolling in the minimap conflicts with the built in scroll, causing issues navigating around a file. As such, this is one feature I will have to live with out (at least for now).
Clang Format is a great plugin that has taken the place of a linter I would normally use in Sublime. Clang Format allows you to specify a set of rules by which you want to format your code. Running the tool will then modify your code to abide by those rules. You can use one of the built in styles, or customize one to your liking in a
.clang-format file in your repo. This is what mine looks like:
BasedOnStyle: LLVM IndentWidth: 4 ObjCBlockIndentWidth: 4 UseTab: Never BreakBeforeBraces: Linux AllowShortIfStatementsOnASingleLine: false AllowShortFunctionsOnASingleLine: false AllowShortBlocksOnASingleLine: false AllowShortCaseLabelsOnASingleLine: false AllowShortLoopsOnASingleLine: false IndentCaseLabels: false ColumnLimit: 120 SpacesBeforeTrailingComments: 2 AlignAfterOpenBracket: true
The Basic Comforts
One thing to make Xcode really feel like home is customizing its keyboard shortcuts. The commands I use most often are “Open Quickly…”, “Show Document Items”, “Select Line”, and “Edit All in Scope”, which I have mapped to cmd-P, cmd-E, cmd-L, and cmd-D, respectively. Additionally, I remapped the Home and End keys to jump to the beginning and end of the current line, rather than beginning and end of the file (as is the default).
I chose these shortcuts to mimic the ones I use most in Sublime. The variance here is that Xcode doesn’t really have the multi-cursor editing capabilities of Sublime, so “Edit All in Scope” will have to do as a replacement. Additionally the Sublime parallel to “Show Document Items” is the “Goto Symbol” command. “Goto Symbol” is mapped to cmd-R in Sublime, but I couldn’t bring myself to break that default in Xcode, so one key over (cmd-E) will have to do.
Laying out the Furniture
The final step to making Xcode feel like home is roping in the various tabs and panes Xcode opens (e.g. the Debug pane). My solution for managing the Navigator, Debug, and Utilities panes is to map the shortcuts for toggling each of them to cmd-opt-left, cmd-opt-down, and cmd-opt-right respectively.
I make heavy use of the Assistant Editor (cmd-opt-return), as I am used to editing with multiple editor panes in Sublime Text. In order to make the Assistant Editor a little more useful for my workflow, I have enabled “Uses Focused Editor” under
Xcode Preferences > Navigation. This enables all of the navigation shortcuts (“Open Quickly…”, “Show Document Items”, etc.) to work in the Assistant Editor when it has focus.
Living in It
A workflow should never be so rigid as to not be open to other ideas. If you have any convictions about how to make Xcode work for you, I would love to hear them in the comments below.
Stay in the loop with our latest content!
Select the topics you’re interested to receive our new relevant content in your inbox. Don’t worry, we won’t spam you.
The 5 Minute Accessibility StrategyMay 18, 2023
We discuss how you can make a plan in just 5 minutes to provide accessibility in your mobile app.Read more
Download a collection of 3 key articles on the state of digital todayApril 14, 2020
As presented by Forbes. Download the top-3 most popular articles published by Michigan Software Labs.Read more