Advertisement
iOS SDK

iOS Quick Tip: 7 Tips to Speed Up Your Development

by

Most developers are always looking for ways to improve or automate their workflow being it with a simple script to automate a common task or by learning every possible keyboard shortcut of their favorite text editor. In this article, I will show you seven tips that will speed up and streamline your workflow in Xcode.


1. Keyboard Shortcuts

Virtually every Xcode command has a keyboard shortcut that you can learn and even customize. Investing the time to learn keyboard shortcuts will increase your efficiency tremendously. If you are like me, and a lot of other developers, you prefer to keep your hands on the keyboard when you're writing code and that is exactly what most key bindings are for.

If you don't like the default keyboard shortcuts, then you'll be happy to learn that you can customize Xcode's default keyboard shortcuts in the Preferences window under the Key Bindings tab.

iOS Quick Tip: 5 Tips to Speed Up Your Development - Managing Key Bindings in Xcode's Preferences Window

If you don't want to scroll through the long list of keyboard shortcuts to learn the most important ones, then I recommend browsing through this question on Stack Overflow. It lists the most important key bindings in Xcode and also includes a number of other neat tips and tricks.


2. Cocoapods

Cocoapods, a great project started by Eloy Durán, has gained significant traction in the Cocoa community. What is Cocoapods? Cocoapods is a tool for managing dependencies in Xcode projects. Due to Cocoapods' popularity, hundreds of third party libraries have been updated to support Cocoapods. Even though Cocoapods is distributed as a Ruby gem, you don't need to understand Ruby to benefit from Cocoapods.

If you are tired of manually managing third party libraries in your iOS or OS X projects, or you're looking for a solution that makes updating third party libraries easier, then Cocoapods is the best solution available. If you want to learn about Cocoapods, then I recommend reading a post about Cocoapods that I wrote earlier this year. It will get you up and running in minutes.


3. Code Snippets

Chances are that you use a text or code snippet manager, such as TextExpander or CodeBox. I use TextExpander all the time and it has saved me countless keystrokes over the years. However, Xcode also has a snippet manager. It lives in Xcode's right sidebar next to the Object Library.

Why should you use Xcode's snippet manager instead of the alternatives I mentioned earlier? In Xcode, each snippet has a number of additional attributes that really make snippets powerful and flexible. Each snippet has a Platform and Language attribute as well as a completion scope. A snippet's completion scope is especially useful and integrates neatly with Xcode's editor. Did I mention that each snippet can have multiple placeholders?

iOS Quick Tip: 5 Tips to Speed Up Your Development - Creating and Managing Code Snippets is Very Easy in Xcode

4. Learn Git

If you've just started to learn how to program and the concept source control is new to you, then I strongly recommend that you take some time to learn the basics of Git. Git is a distributed version control and source code management system. Euh ... what? In short, Git helps you manage your source code easily and efficiently. Combine Git with GitHub or BitBucket and you are starting to look like a professional programmer. The added benefit is that Xcode integrates nicely with Git and this integration will only improve over time.

Once you've learned the basics of Git, it is recommended to include a proper .gitignore file in your Xcode project. A good place to start is this question on Stack Overflow.

Even though Git is commonly used through the command line, there are a number of applications that provide a GUI (Graphical User Interface). My favorite is Tower, developed by Fournova, which recently reached version 1.5. Atlassian's SourceTree is another great and free alternative.


5. Xcode Behaviors

Xcode is an incredibly powerful editor and it only gets better over the years. One of the aspects that I use frequently is Xcode's Behaviors feature. By defining behaviors, you can tell Xcode what it should do when a particular event occurs, such as when a crash occurs while debugging or when you've successfully archived an application.

You can configure these behaviors in Xcode's Preferences Window. If you don't like it when Xcode shows the console when output is generated, you can disable this behavior in the Behaviors panel. Do you want Xcode to show the Issues Navigator when one or more tests fail? This is all possible with Xcode Behaviors.

iOS Quick Tip: 5 Tips to Speed Up Your Development - Managing Behaviors in Xcode's Preferences Window

Xcode predefines a number of common behaviors for you, such as Build, Testing, and Running. However, you can also define custom behaviors and assign a keyboard shortcut to it. This is a convenient way to set up Xcode the way you want with a single key binding.


6. Tabs and Windows

I really like the unified look of Xcode 4 and the integration of Interface Builder. However, it is sometimes useful to have more than one window at hand, for example, when you are working in the console and the editor at the same time or you use multiple monitors. In Xcode 4, it is still possible to work with multiple windows. You can create a new window using the keyboard shortcut Shift + Cmd + T or use the menu, File > New > Window.

Even more useful are tabs. Almost every code editor has tabs these days and Xcode is no exception. I rarely find myself in an Xcode window that has no, or one, tab. What few people know is that Xcode tabs can be named. You can even tie named tabs and Xcode behaviors together, which is especially useful during debugging.


7. Documentation

Even if you've been developing Cocoa applications for years, the documentation should never be more than a click away. There are a number of ways to quickly access Xcode's documentation browser. The solution I use most often is holding the option key and clicking a method in Xcode's code editor. This presents you with a summary of the particular method. If you want to read more or open the documentation browser, you can click one of the links in the pop up window.

iOS Quick Tip: 5 Tips to Speed Up Your Development - The Documentation is Your Friend

You can achieve the same by opening Xcode's right sidebar and open the Quick Help Inspector tab. The help inspector updates as the cursor moves. As with the pop up window, clicking on one of the links in the help inspector takes you to the respective section in the documentation in the documentation browser.

iOS Quick Tip: 5 Tips to Speed Up Your Development - The Quick Help Inspector

One of the downsides of Xcode's documentation browser is that it can be slow at times. For this reason, I frequently use Dash, a dedicated documentation and snippet manager. Dash is very fast and provides support for more than eighty languages, libraries, frameworks, and APIs. It is well worth checking out.

Conclusion

There are a lot more tips and tricks that can help you during your development, but these are the ones that I use most frequently. Are there any tips that you use all the time and save you a lot of time? Feel free to share them in the comments below.

Related Posts
  • Code
    Mobile Development
    Introducing Alcatraz 1.0Preview image@2x
    In this quick tip, I'd like to tell you about Alcatraz, an open-source package manager for Xcode 5. After reading this quick tip, you won't be able to live without it.Read More…
  • Code
    Mobile Development
    iOS: Tools of the Trade741pm preview image@2x
    There are numerous tools and services that have become indispensable in the workflow of many Cocoa developers. In this article, I will highlight some of the tools that I use as well as some alternatives.Read More…
  • Code
    Tools & Tips
    Check Out Atom, GitHub's New Development EditorAtom wide retina preview
    It's been awhile since we've seen any updates in the editor space. The last big splash was made by Sublime Text which took the web development community by storm, especially once Package Control came around to serve as the package manager for the editor.Read More…
  • Computer Skills
    Productivity
    Why a Finder Replacement is Still a Good IdeaFinder2x
    Until OS X Mavericks, a replacement Finder application was a must for most power users. Basic features like tabs were missing from OS X’s default application, so to get an improved Finder experience you had to turn to third parties. With Mavericks, however, Apple has finally brought tabs to Finder. In this tutorial I’ll show you what replacement Finder applications are out there, what they can still add to your workflow and why they're still worth getting.Read More…
  • Code
    Tools & Tips
    Coding in the CloudCoding in cloud retina preview
    The Internet has allowed us to work anywhere we want, giving us tremendous flexibility in choosing where we'd like to plant ourselves to build the next great app. Not being tied to an office desk has been a blessing to many who cherish the ability to work in varying environments and draw inspiration from their surroundings. But for the most part, we've needed to have a full-blown development machine to make this happen. What if we could leverage the cloud as a development environment itself, freeing us up to choose from a variety of devices to accomplish the same thing. That's what we'll explore in this article.Read More…
  • Code
    iOS SDK
    Objective-C Succinctly: Introduction0e5ds8 preview image@2x
    Objective-C is the programming language behind native Apple applications. The language was originally designed in the 1980s as a way to add object-oriented capabilities to the ANSI C programming language, and it has since been used to create everything from command-line tools to Mac programs to mobile apps. You can think of Objective-C as Apple's version of the C# programming language.Read More…