Being used to IDEs like Eclipse, I feel kind of crippled when I’m using Xcode. Should I start using AppCode? Probably. But for now, some tips to make life a bit easier.

Custom Shortcuts

In Eclipse, I’m used to constantly moving code around with my keyboard. Two simple examples:

  • Alt + Cmd + up/down: Copy selected code up/down
  • Cmd + d: Delete current line or selection
...  <key>My Custom Shortcuts</key>
<key>Delete Current line</key>
<string>moveToBeginningOfLine:, deleteToEndOfLine:,
<key>Move Line Up</key>
<string>moveToBeginningOfLine:, selectLine:, cut:, moveUp:,
paste:, moveUp:</string>
<key>Move Line Down</key>
<string>moveToBeginningOfLine:, selectLine:, cut:,
moveDown:, paste:, moveUp:</string>
<key>Copy Line Up</key>
<string>moveToBeginningOfLine:, selectLine:, copy:,
moveToBeginningOfLine:, paste:, moveUp:</string>
<key>Copy Line Down</key>
<string>moveToBeginningOfLine:, selectLine:, copy:,
moveDown:, paste:, moveUp:</string>
Wire up your custom shortcuts in preferences (Cmd + ,)

Refactor Shortcuts

In Eclipse, I constantly hit Cmd + 1 for all sort of context-aware actions. I use this mostly for refactoring: Renaming a variable, extracting code to a method, etc. In Xcode you can only bind such actions to separate keys…

Hit Cmd + Shift + / to open the help/search feature of OS X and quick search your refactor functionality

Interface Builder Runtime Attributes

Sometimes, you create a view that should be transparent. Working with transparent views in IB can be very annoying, as you are unable to see them. A solution is to make the view visible by giving it a color:

Giving a transparent view a color
Hit Alt + Cmd + 3 and add some User Defined Runtime Attributes

Tech enthusiast

Tech enthusiast