IOS development tips-custom XCode code snippets

Source: Internet
Author: User

IOS development tips-custom XCode code snippets

There is a saying that smart programmers Know How To Be "lazy" to improve development efficiency. in our daily development, some code snippets are often used. You may think that defining some macros can solve the problem, but you may encounter protocol methods such as UITableView, or do you want to quickly define a UIButton when writing a Demo (except storyboard, of course?

Okay. What is a code snippet first?

Enter if in XCode, select ifelse, and press Enter.


This is the code snippet that the system has defined for us. It can quickly complete the code snippets we want and greatly improve the programming efficiency of programmers. What we need to do is to achieve this effect.

The procedure is actually very simple. Use the UITableView protocol method as an example.


Remember! <# The parameter name prompt you want to give #> is the key.

Finally, the code snippets in Xcode are stored in ~ by default ~ /Library/Developer/Xcode/UserData/CodeSnippets can be directly copied to others for sharing resources.

In addition, we can also define many other commonly used code snippets, which is much better than defining them as macros. For example, the singleton... attribute... let's try it by yourself.

@ Reprinted please note, iOS @ confused little bookboy, thank you!


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.