Xcode Keyboard Shortcuts Help You Accelerate Work

Xcode Keyboard Shortcuts Help You Accelerate Work

In this post, we’ll walk through lots of Xcode keyboard shortcuts that I found useful. I hope they help you improve your efficiency as a developer too.

If you don’t remember shortcuts, using a mouse at least helps you get work done quickly. Moreover, learning shortcuts feels like an additional learning curve especially when you’re getting started.

I’ve often heard developers giving excuses to for not learning Xcode shortcuts when they’re starting out. In their defense, they have a valid argument:

In this post, we’ll walk through lots of Xcode keyboard shortcuts that I found useful. I hope they help you improve your efficiency as a developer too.

Basic Shortcuts

Here’s a list of the most common shortcuts used in Xcode:

  • Build: ⌘ + B
  • Run: ⌘ + R
  • Test: ⌘ + U
  • Stop: ⌘ + .
  • Clean: ⌘ + ⇧ + K
  • Clean the build folder: ⌘ + ⇧ + ⌥ + K
  • Open quickly: ⇧ + ⌘ + O
  • Code completion: ⌃ + Space
Assistant Editors Shortcuts

Xcode 11 brought a lot of changes to their assistant editors. Now, you can add as many editors as you want, toggle focus mode on the current editor, or focuses on the current editor whilst hiding others. Additionally, a new button has been introduced that lets you set the position of the secondary editor relative to the current one.

Adding a secondary editor

The following shortcut lets you add secondary editor(s). The new editors aren’t reflected on your screen if you’re in focus mode.

Shortcut: ⌃ + ⌘ + T (Control + Command + T)

By hovering over the “Add New Editor” Button and holding the Option Key, we can toggle the position of the new editor to the right or bottom.

Focusing current editor

To hide all but the current editor, use the following set of keys:

Shortcut: ⇧ + ⌃ + ⌘ + ↩ (Shift + Control + Command + Enter)

Opening a file manually in assistant editor

One big change in the Xcode 11 Assistant Editor is that there is no manual option. In order to open a destination file in the secondary editor, do a Shift + Command + O todo a quick open, and press the option key while selecting the file, as shown:

Shortcut: ⇧ + ⌘ + O followed by ⌥

Navigation across editors

When working with multiple assistant editors and you need to switch between them, using the trackpad breaks the flow. Here are the shortcuts that let you deal with navigation across multiple editors:

Highlight Editor: ⌘ + J (Command + J)

Once the current editor gets highlighted you can navigation between the assistant editors with the arrow keys and press Return on the new editor to make it the active one.

Fix All Errors In-Scope

I often come across scenarios where Xcode throws a lot of errors at me, specifically related to Swift syntax — which is common when you’re migrating across different versions.

Luckily the Fix-it All at once option works well for most of the general errors and saves us a lot of time, especially in huge projects.

Shortcut: ⌃+ ⌥ + ⌘ + F

(Control + Option + Command + F)

Multiple Cursors on Multiple Selections

Often, there’s a need to use multiple cursors to avoid typing/copying the same thing on different lines. We can do that by selecting the current word and pressing Alt + Command + E to select the next occurrence(s). This places multiple cursors on the words and allows us to edit them together.

Shortcut: ⌥ + ⌘ + E

(Option + Command + E)

To select the previous occurrence, Shift + Option + Command + E is used.

Refactor All In Scope

Refactoring is inevitable. That makes editing variables and methods in the scope a crucial tool. The following shortcut lets us edit all in scope together at the same time:

Shortcut: ⌃ + ⌘ + E

(Control + Command + E)

Jump to Method

In order to look at the outline of your file, the methods present, simply press Command + 6. It opens a jump bar from where you can search the desired method and you jump directly to it.

Shortcut: ⌃+ 6

(Control + 6)

Jump to Definition

Since Xcode 9, command+click doesn’t directly take you to the definition. Instead, it shows you a pop-up hint with a list of options. In order to directly jump to the definition without seeing the pop-up use the following shortcut:

Shortcut: ⌃ + ⌘ + J

(Control + Command + J)

Fold and Unfold Methods

When your file sizes are going out of bounds (which ideally they shouldn’t) there’s a handy shortcut that lets you do code folding and collapse all methods/selective methods.

It puts a code ribbon on each enclosing block. Following are the shortcuts for the different cases:

Fold All: ⇧ +⌥ + ⌘ + ←

(Shift + Option + Command + Left Arrow)

Unfold All: ⇧ +⌥ + ⌘ + →

(Shift + Option + Command + Right Arrow)

Fold Current Block: ⌥ + ⌘ + ←

(Option + Command + Left Arrow)

Closing Tabs

Xcode has a lot of shortcuts that let you choose the tab you want to close. It can be the current one or all but the current one. The shortcuts for each of the use cases are given below:

Close Tab: ⌘ + W

(Command + W)

Close Other Tabs: ⌘ + ⌥ + W

(Command + Option + W)

Reorder Statements

To change the order of statements and to move them over one another the following shortcut is used:

Shortcut: ⌘ + ⌥ + ( ] or [ )

(Command + Option + Square Brackets)

Find Call Hierarchy

To quickly find the call hierarchy of the selected symbol, be it a method or an instance, just use the following shortcut. It opens the call hierarchy in the project navigator.

Shortcut: ⇧ + ⌃ + ⌘ + H

(Shift + Control + Command + H)

Global Search And Or Replace

Xcode IDE has the ability to do a quick global search and even has the ability to replace the symbols everywhere (handle with care).

Search in the whole project: ⇧ + ⌘ + F

(Shift + Command + F)

Search & Replace in the whole project: ⇧ +⌥ + ⌘ + F

(Shift + Command + Option + F)

SwiftUI Previews

SwiftUI has changed the way we think and build UIs. With a built-in canvas preview in Xcode, building UI through code or directly in the previews has just got a lot easier. The shortcuts are just the icing on the cake to speed up your development process.

Toggle canvas

If you’re looking to quickly build a prototype in code without letting the live previews distract you until its done, this is a handy shortcut.

Shortcut:⌥ + ⌘ + ↩

(Option + Command + Enter)

Resume automatic previews

Often the automatic preview pauses and requires us to manually resume it. Xcode 11 gladly has a shortcut for this.

Shortcut: ⌥ + ⌘ + P

(Option + Command + P)

Minimap Shortcuts

Xcode 11 gave us minimaps. A much-needed outline view of your code on the right-hand side of the IDE. By hovering over it you can navigate to any part of your code.

Among the important shortcuts, one lets you toggle the minimap view while the other shows an outline of all the properties, methods, classes and blocks of code in the file:

Toggle Minimaps: ⇧ + ⌃ + ⌘ + F

(Shift + Control + Command + F)

Minimap Outline: ⇧ + ⌃ + ⌘

(Shift + Control + Command)

Conclusion

We’ve had a quick tour through a lot of Xcode shortcuts that can increase your productivity and speed by leaps and bounds. Xcode 11 has introduced some handy utilities and shortcuts that should only help you accelerate your work.

For developers getting started with shortcuts, I’d recommend to take it slowly. Choose a few shortcuts and include them in your daily use cases to build up that muscle memory. Trying to memorize everything at once isn’t the optimal way to master keyboard shortcuts.

That’s it for this one — thanks for reading! Please share if you liked it!

Top iOS Mobile App Development Agency in New York

Top iOS Mobile App Development Agency in New York

Are you looking for a [Top iOS Mobile App Development Agency in New York]**(https://www.appcluesinfotech.com/ios-app-develop**ment-company/ "Top iOS Mobile App Development Agency in New York") for your app projects? Then AppClues Infotech is the...

Are you looking for a Top iOS Mobile App Development Agency in New York for your app projects? Then AppClues Infotech is the reliable & trustworthy iOS mobile app development company in New York offering excellent iOS, iPhone, iPad and wearable app development, etc. technology solutions to their clients at an affordable price.

We believed to be one of the successful providers of iOS app development services. We have a dedicated team of developers and designers who have high knowledge and the best strength of developing any type of iOS apps.

Our iOS App Development Service:
• iOS App UX / UI Design
• Native & Hybrid iOS App Development
• App Redesigning
• iOS App Programming
• App Testing for flawless Performance
• App Support & Maintenance

For more info:
Visit: https://www.appcluesinfotech.com/
Email: [email protected]
Call: +1-978-309-9910

Top 10 Companies To Hire iPhone App Developer

Top 10 Companies To Hire iPhone App Developer

Searching to hire iPhone App Developer? This list will make you easy to hire iOS app developer for your next idea.

Are you searching ‘how to hire iPhone App Developers? This list of Top 10 Companies to hire iOS app developer will make you easy to find a reliable iPhone app development company. Below the list of the best iOS app development companies, is listed as per company review and ranking in the clutch and Good Firms. This Updated List of Top iPhone Application Development Companies will help you shortlist iOS app developers, hire ios developer that suits your project.

Read More:https://www.techgropse.com/blog/hire-iphone-app-developer/

Mobile App Development Company India | Ecommerce Web Development Company India

Mobile App Development Company India | Ecommerce Web Development Company India

Best Mobile App Development Company India, WebClues Global is one of the leading web and mobile app development company. Our team offers complete IT solutions including Cross-Platform App Development, CMS & E-Commerce, and UI/UX Design.

We are custom eCommerce Development Company working with all types of industry verticals and providing them end-to-end solutions for their eCommerce store development.

Know more about Top E-Commerce Web Development Company