Seven Xcode tips every developer should know

Seven Xcode tips every developer should know

If you want to do your work well, you must first sharpen your tools. For an iOS developer, this means mastering Xcode. Xcode is a software that is a bit difficult to learn, but the following tips may significantly improve your programming efficiency.

1. Quick Open

The Open Quickly command is in the File menu of Xcode. Of course, it is more convenient to use the shortcut Command+Shift+O. This command can open a small pane for quickly searching and browsing files, classes, algorithms, and functions.

This command saves me tons of time every day, and if you haven’t tried the quick open command yet, I highly recommend you give it a try.

2. Display the project navigator

In a large project with many files and folders, the Reveal in Project Navigator command can save you a lot of time. This command displays the current file in the Project Navigator bar on the left side of the interface. The default shortcut is Command + Shift + J.

3. Assistant Editor

You may already be familiar with the Assistant Editor. Many developers don't use it enough, but it's great to be able to display a copy of a file or work in the user interface and view controller at the same time.

The Assistant Editor can be used in many ways, but I often use it to find out where a particular algorithm appears and how it is called. To see this, move the cursor into the body of an algorithm and select Callers from the top menu of the Assistant Editor.

4. Jump to method

When working with classes or structures, I often need to quickly jump to a specific method in the class. This is very conveniently done by using the shortcut Control + 6 followed by the first few letters of the algorithm.

5. Browse the documentation

No matter how experienced you are, documentation is always a developer’s best friend. You can quickly open Xcode’s documentation browser by holding down the Option key and clicking the symbol you’re interested in, where you can search for a specific class or method.

Here I recommend the Dash document browser, which is faster and more powerful than the built-in document browser of Xcdoe. In order to achieve the same effect as above on Dash, you need to install an Xcode plug-in.

6. Scope Editing

Multiple cursors are a great feature that every advanced editor should have. Xcode's code editor also has this feature, but it is hard to find and hard to use. In Xcode, this feature is called Edit All in Scope (default shortcut Ctrl+Command+E).

Move the cursor to the symbol you want to edit. If the mouse pointer stays on the character for one or two seconds, a small inverted triangle will appear on the right side of the character. Click the triangle and select Edit All in Scope from the menu. You can also set a shortcut key for this command. (Modification method: Preferences -> Key Bindings -> Search for "Edit all in scope")

Unfortunately, Xcode's implementation of multiple cursors is not as powerful as Atom or Sublime Text. As far as I know, Xcode's multiple cursors only work for symbols.

7. Who is the glutton?

Do you work in a team? Have you ever needed or just wanted to know who wrote that horrible error line of code? Move the cursor to the line with the error, right-click and select Show Blame for Line from the menu. Oops, did you do that?

<<:  Sharing of research methods on plain text reading experience on mobile terminals

>>:  WeChat payment practice version

Recommend

Why do some phones charge faster?

The charging process of a smartphone is mainly com...

Educational products use private domain traffic techniques!

When we operate educational products, there is no...

Google Play is not far from China, maybe it will return by the end of the year

Many foreign media have confirmed that Google int...

Why are people who talk more nonsense happier?

This article was reviewed by Zhao Wei, MD, associ...

2022 National Public Security Professional Knowledge Course

Course Catalog: ├──00 Electronic version of the b...

Is toothpaste afraid of water? Will it be ineffective if you dip it in water?

There is a long-standing topic on the Internet: s...

Kuaishou account cold start tips and operation guide!

How to cold start a new short video account is a ...

Android is not secure, Google is not clear

The twenty-six letters of the alphabet have all b...