We all use Xcode for iOS development and we certainly know how to get around the IDE with no issues whatsoever right?
Well that might not be the case. In this post, I will show you some pretty neat and efficient tricks I’ve learned which can help speed up your daily development.

1.  Indentation

It’s inevitable that the indentation of a file will change as you work on it. Instead of using spaces or tabs to align, rather select the code that is not indented correctly and press ⌃ + I to fix it quickly.

 

 

2.  Renaming a variable

We’ve all come across the situation where we want to rename the variable across a whole scope.
To do this highlight the variable and press ⌘ + ⌃ + E.

 

 

3.  Highlight using warnings

This is pretty cool one which I’ve discovered recently. Use #warning(“This is a warning”) to highlight something you wouldn’t want to forget about. Use #error(“message”) to generate an error that will NOT let you build the project.

 

4.  Search

The search field might have more functionality than you may think. Here’s how to use it:

  1. At the bottom of the project navigation panel, you will find the filter/search field.
  2. You will find two buttons: a clock and a square (source control).
  3. Tapping on the clock will present you with files you’ve opened up recently.
  4. The source control icon shows files that you’ve modified and not yet committed.

 

5.  Filter

You can access the filtering panel presented above by tapping ⌥ + ⌘ + J.

 

6.  Jump to file

If you are working on a large codebase with multiple different files, the ‘Open Quickly’ shortcut ⇧ + ⌘ + O will give you ability to jump to any file, type, or method in your project. Using a colon : lets you specify the particular line.

 

 

7.  Edit on multiple lines

This is useful for all those variables we need to quickly convert to private. Holding down the ⌥ key and dragging over with mouse allows you to create multiple cursors and edit code on multiple lines at the same time.

 

 

8.  Use snippets

Snippets are short code cutouts that are accessible from snippets library (which is available alternative for object library). You can put your favourite functions there along with some placeholder values to quickly reuse some of your favourite code snippets throughout your new projects.

 

 

9.  Clever commenting

Commenting your code efficiently will help keep your code more readable and organised, try using special tags like “MARK, TODO and FIXME”. They let you create special section separators in your code. Mark and todo both share a menu icon, while FIXME has distinct bandaid image.

 

10.  Open with Terminal

Only real developers open their Xcode projects via Terminal! If you run the xed. command in the main index of any Xcode project, it will open the project directly.

 

Now you know some cool new tricks that you can start using into our projects and show off to your fellow developer colleagues!

xCode download link: https://developer.apple.com/xcode/