Making Xcode Feel Like Home

May 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?

The starting point for customizing any editor is its plugin manager. Sublime Text has the third party Package Control, and similarly Alcatraz is the de facto tool for managing your Xcode plugins.

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

/Applications/Xcode.app/Contents/SharedFrameworks/DVTKit.framework/Versions/A/Resources/DVTIbeamCursor.tiff

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.

Jeff Kloosterman
Jeff Kloosterman
Head of Product Development

Looking for more like this?

Sign up for our monthly newsletter to receive helpful articles, case studies, and stories from our team.

User research: The heartbeat of successful development
Business Design Process

User research: The heartbeat of successful development

July 15, 2024

User research in software development is essential for success. Learn how consistently engaging in methods like user interviews, usability testing, and field studies throughout the product lifecycle, helps ensure your solutions align closely with user needs.

Read more
How brain-computer-interfaces could improve human health
Business

How brain-computer-interfaces could improve human health

May 13, 2024

Read more
Quickly Prototyping a Ktor HTTP API
Development Web

Quickly Prototyping a Ktor HTTP API

August 18, 2022

Whether it’s needing a quick REST API for a personal project, or quickly prototyping a mockup for a client, I like to look for web server frameworks that help me get up and running with minimal configuration and are easy to use. I recently converted a personal project’s API from an Express web server to a Ktor web server and it felt like a breeze. I’ll share below an example of what I found and how easy it is to get a Ktor server up and running.

Read more
View more articles