⬆️ ⬇️

How to make your life easier in Xcode. Shortcuts, tips & tricks

image

Effective work in any IDE, and not only in the IDE, is determined to a large extent by how much you use keyboard shortcuts and all sorts of features designed to make your life easier.

In this post I will try to share what I know and use myself, what has accumulated on the network, but I also count on your help. Share your finds and tricks. According to the results, I think to make some kind of PDF, like the famous Xcode-pdf pdf with shortcuts from Colin Wheeler (don’t you know? Then there’s a link )



As for keyboard shortcuts, it is worth viewing the specified PDF. There are a lot of shortcuts, but there are some that I use more often than others.

Define symbols to describe shortcuts:

βŒƒ - Control

⌘ - Command

βŒ₯ - Alt

⇧ - Shift

⏎ - Enter / Return

βŽ‹ - Escape

β†’ ← ↑ ↓ - Cursor



βŒƒβŒ˜ ↑ - Switch between header file and implementation. Probably the most frequently used combination.

⌘T - Opening a new tab (tab). By the way, if you click on the tab heading, you can give it a name, for example Debug.

CT - Open new window

β‡§βŒ˜] - ​​go to next tab

β‡§βŒ˜ [- go to previous tab

⌘W - close the current tab, or window, if the tab is the only



⌘N - create a new file

⌘S - save current file

βŒ₯⌘S - save all changes in all open files

')

When typing:

If you need to remove what autocomplete offers, then just press βŽ‹ Esc

and βŒ₯βŽ‹ - if you want to see code completion.



⌘F - search in current file

β‡§βŒ˜F - search for the entire project

⌘G - go to next search result

β‡§βŒ˜G - go to previous search result



⌘ + 1..7 - switch between navigators.



⌘ / - comment out / uncomment the current line or a selected block, uncommenting works correctly only if the comment character is at the beginning of the line.



⌘] - shift the line / highlighted block to the right

⌘ [- move the line / selected block to the left



⌘R - run the program

⌘I - run the program with tools (allocations, leaks etc.)



βŒƒβŒ₯⌘0 - show / hide utility panel (right panel)

βŒƒβŒ₯⌘1..4 - switching between libraries of templates, snippets, objects and media data



Some more shortcuts from arturphoenix

β‡§βŒ˜O - fast opening of a file or transition within a file.

⌘L - go to line with number

βŒƒβŒ˜E (when setting the cursor to a variable) - quick renaming of a variable in the current scope.



I would like to dwell separately on snippets.

In addition to existing snippets (code snippets), you can create and edit your own ones.

Create a snippet for the #pragma mark

Open the snippets library by pressing βŒƒβŒ₯⌘2 if it is not open.

First, select the necessary fragment in the code:

image

Next, with the mouse drag the selection into the window of the snippet, the editing window opens. Set the name:

image

Shorkat:

image

the scope (visibility) of the snippet (in our case, all) and the placeholder into which custom text will be inserted. Placeholder is set in this format - <# placeholder #>:

image

Click Done and see what we did. In the code, we start to type mark:

image

We get a hint of auto-population, click and it remains only to enter the text of the marking:

image

Very handy thing. I added a lot of things to myself.



Waiting for your comments, shortcuts and tricks to improve the performance in Xcode!

Source: https://habr.com/ru/post/147097/



All Articles