Want to offer native, in-app customer service to your users? Get going quickly with Zendesk’s Mobile SDKs. Free with Zendesk.

Active Filters: Plugins

Plugins are a great way for us to extend Xcode, adding functionality that Apple didn't ship with it. We've covered Xcode plugins a bit here in the past, notably in Bite #147, where we learned about using Alcatraz to install plugins. Today we'll look at a new plugin called BuildTimeAnalyzer from Robert Gummesson. It can help uncover why are code is compiling slowly. Let's dive in.

We'll start by completing the steps in Bite #147 to install Alcatraz. (If we're going to be installing and trying out plugins Alcatraz is a good way to organize and manage everything).

Once installed, we'll open the Alcatraz Package Manager by going to Window > Package Manager.

We can search for "BuildTimeAnalyzer" in the search field to find the plugin and install it. Once installed, we'll restart Xcode and open our project.

We can open the analyzer window by selecting View > Build Time Analyzer from Xcode's menu.

Next, we'll need to add some compiler flags.

(Remember to add these to any other targets your app may depend to see compile times for those too).

We'll add -Xfrontend and -debug-time-function-bodies to the "Other Swift Flags" in our app's target's build settings.

After that, one last clean and build and we should start to see a list of how long each bit of our code is taking to compile. Neat!

We can click on each result to jump straight to the line of code that's causing the slow down. The results are often surprising!

For example: Adding Collection types together seems to bring the Swift compiler to a slow crawl.

What interesting slow downs did you find in your code? Send them to @lilbitesofcocoa on Twitter!

More info about BuildTimeAnalyzer can be found at git.io/bta

In Bite #147 we looked at installing Xcode Plugins using the Alcatraz Package Manager. Today we'll look at a few plugins we can install that will make the experience of writing code in Xcode much better. Let's get started.

First up is Fuzzy Autocomplete. In Bite #146, we covered using Xcode's "Quick Open" dialog. It has this great "fuzzy matching" feature where (for example) we can type something like "upvc" and it will match UserProfileViewController.swift. This plugin brings that exact same functionality to Xcode's autocomplete:

Next, a simple one. Normally when we press ⌘← in Xcode, it jumps all the way to the very beginning of the line. The Xcode Beginning of Line plugin alters this, and instead jumps to the first character of code. Neat!

The QuickJump plugin is super fun. We can activate it with a keyboard shortcut, then it will display a bunch of characters, we type the one where we want our cursor to move and we're there!

Refactorator let us rename functions, vars, enums etc. in Swift!

Finally, with the KSImageNamed plugin, Xcode will autocomplete names of images, when calling functions like UIImage(named:):

All of the plugins mentioned here are available in Alcatraz.

Xcode is an incredible piece of software with tons of great features. There's always room for improvement, though. Today we'll look at Alcatraz.

It's a plugin for Xcode that lets us install other plugins for Xcode. (Also themes and templates). Let's get started.

We'll begin by installing Alcatraz. We can find an install command ready for us to copy and paste to our terminal on alcatraz.io.

We'll quit Xcode, then run this to install Acatraz into Xcode:

curl -fsSL https://raw.githubusercontent.com/supermarin/Alcatraz/deploy/Scripts/install.sh | sh

Then, we'll re-launch Xcode. We'll now see a new menu: Window > Package Manager (or ⌘⇧9).

Now, we can simple browse through the available plugins, and click to install we'd like. After installing anything, we'll need to restart Xcode to see its effect. Let's test it out now!

One incredibly simple feature missing from Xcode is the ability to quickly change the font size with ⌘+ and ⌘-.

We'll scroll down to the AdjustFontSize plugin and click Install.

We'll restart Xcode then open a project and try it out. Success! Try installing a theme or some templates next!

More info about Alcatraz can be found at alcatraz.io