IOS Xcode Authoring Template class

Source: Internet
Author: User

Reprint Please indicate the sourcehttp://blog.csdn.net/uxyheaven/article/details/48419963 Why to define a template class

Adherence to code specifications can improve code readability and reduce later maintenance costs. When we set up a code specification that the team agreed to, we asked all the Viewcontroller code to be organized as follows:

#pragma mark - def#pragma mark - override#pragma mark - api#pragma mark - model event #pragma mark - view event#pragma mark - private#pragma mark - getter / setter
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

When you get to the ground, you know ....

How to ask for freedom of developer all follow this to write, especially have to write down this specification first.
Static checking is a method. Review is a way of forcing a change. This article will introduce another way to create a template class.

How to use a well-defined template class

How to use a well-defined template class to see an animation directly:

When creating a class template file, move the code organization specification that we have defined. So it's not too casual for everyone to write code?

How template classes are made

Make a template class from scratch some pits. We take a simple approach by copying a template class and then modifying it to look the way you want.
Https://github.com/uxyheaven/XYXcodeTemplate here is a template for the author to build a simple template class. First download down, then modify the look you need, and finally copy to Xcode (when writing this article is Xcode6 Oh, if the future directory changed, self-search) in the File template folder /Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates/File Templates/Folder . So it can be used.

Modification Instructions

Inherit from the system class directly in the folder of the System class.

    • As inherited from Uiviewcontroller, in Viewcontroller.
    • ___FILEBASENAME___.hChange the code to what you want.
    • ___FILEBASENAME___.mChange the code to what you want.

Some additional settings are required to inherit from the custom class

    • Change the name of the folder to the name of the base class
    • Item 1, values, item 1, options in Templateinfo.plist change to the name of the base class

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

IOS Xcode Authoring Template class

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.