(GO) simplifies 6 Xcode tips for iOS app development

Source: Internet
Author: User

Xcode is the IDE used by iphone and ipad developers to encode or develop iOS apps. Xcode has a lot of small but useful features that we may not notice in many cases, or we don't use these features at the right level to simplify our iOS development. such as comment tags, code snippets, and many others ...

Here are some of the most useful Xcode features we've found:

Fixme

This tag is used to remind you that there is a part of your code that needs to be modified at a later time. (Edit note: There are some auxiliary plugins on the network that can be used to collect ' TODO ' and ' fixme ' tags in the project, such as Xtodo Https://github.com/trawor/XToDo)

Todo

' TODO ' is used to remind the Code at that point that it needs to be returned to continue writing, updating, or adding. The label is typically at the top of the source file for the comment block.

Warning

Use this feature when you want to divide the code area into two categories, one for experimentation and the other for practical use, such as

If we change 0 (zero) to 1 (one), the warning will be automatically deleted, as follows:

This feature will help you ensure that you will never post code that does not appear here, or exclude code that should appear.

Po

This command is very useful during the debugging phase. Normally, in order to print the value of a variable, we need to move the mouse pointer and click and select Print Description to print the value. Sometimes this approach is not friendly to programming, and the PO command makes the process simple and quick, see an example.

In this example, I have created a string named STR and assigned a value to it. Now to print the value without moving the cursor, I now just need to write "PO variable name" in the Output window and press ENTER. As shown below, you will get the value stored in the variable.

5. Code Snippets

Complex applications often need to format very good code so that other iOS developers understand the code, so we need to organize the code in a standard format. But for some larger applications, organizing the code will take time. Xcode provides a function called the Code Snippets Library. We can use it to organize the code.

You can find all of the default code snippets it provides in the Code Snippets Library, or you can create custom code snippets for your own needs, or you can add code snippets to use later. Here's an example of using code snippets:

When we add a new Viewcontroller class, the default code snippet is shown below:

I want to emulate the structure of the memory-related methods and view the lifecycle methods as follows:

To re-use the structure, we need to add this code to the Snippets Library. Now add it and select the text you want to add, as follows:

Use the left mouse button to add it to the Code Snippets Gallery. When you're done adding, you'll see a default "My Code Snippet" name. You can edit the name, or you can add a description and shortcut keys for it.

Find your File

Quickly find the files you need with CMD + SHIFT + O key combination.

Press CMD + SHIFT + O to open quickly window, type the name of the file you are looking for and click on the "Enter" keyboard, the system will be directed to the file you need.

If you are an iOS developer, these tips may be useful if you find other use tips for Xcode, please share them with us.

(GO) simplifies 6 Xcode tips for iOS app development

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.