Xcode Custom code block

Source: Internet
Author: User

First, the function is introduced from the XCODE4. The location in Xcode is as follows:

For example, the right system defines the right code block, including some declarations and implementations of @interface and @implementation that we use very often.

Ii. Customizing the Code block steps we commonly use

The definition of @property attribute is a common feature in Cocoa program development, as an example of how to customize code snippets.

1. Write Code Snippets

Write the following statement where the @property attribute is declared:

@property (nonatomic, assign) int A;

2. Create a new code snippet

1) Click Code Snippet Library

2) Select User Custom

3) The following blank interface appears

4) Select the code you just edited, drag it to the space above, and the following editing window appears

The meanings from top to bottom in the figure are:

①title

The title of the Code fragment

②summary

Description text for code Snippets

③platform

A platform that can use code snippets with Ios/os x/all three options

④language

Which languages can I use the code snippet in

⑤completion Shortcut

A shortcut to the code snippet, which I set to assign

⑥completion Scopes

Which files can be used in the current code snippet, such as all locations, the header file is medium, of course, you can add multiple supported locations.

The last large empty area is a preview of the effect on the snippet.

Such as:

When everything is set up, click the Done button in the lower right corner of the menu and the new job is finished.

5) Verify the effect: I enter assign in the code, click the Enter key, the code is filled with the following

Third, the backup of the code fragment

The code snippet in Xcode is placed by default in the following directory:

~/library/developer/xcode/userdata/codesnippets

We can back up the code snippets in the catalog, or we can copy them out and put them on different computers.

Xcode Custom code block

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.