IOS Xcode template class, iOS Xcode Template

Source: Internet
Author: User

IOS Xcode template class, iOS Xcode Template
IOS Xcode Template

Reprinted please indicate the source http://blog.csdn.net/uxyheaven/article/details/48419963

Why define a template class

Compliance with code specifications can improve code readability and reduce maintenance costs. When we set a code specification that the team agrees with, for example, we require that all viewController code 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

What do you know when it can be implemented ....

Developers who advocate freedom should follow this rule, especially write down this rule first.
Static check is a method. It is a method to force modification during Review. This article will introduce another method to create a template class.

How to Use the Defined Template Class

How to use a defined template class to directly view an animation:

When creating a class template file, we moved all the Code Organization specifications we defined into the file so that everyone could not be too casual to write code?

How to Create a template class

There are some pitfalls in creating a template class from scratch. We adopt a simple method, first copy a template class, and then modify it as needed.
Https://github.com/uxyheaven/xyxcodetemplatehere is a simple template created by the author. download the file, modify it to what you need, and copy it to Xcode (Xcode6 is used for writing this article. If the directory changes in the future, find it on your own )./Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates/File Templates/Folder.

Description

Inherit from the system class and directly change it in the system class folder

  • For example, if it is inherited from UIViewController
  • ___FILEBASENAME___.hChange the code in to what you want
  • ___FILEBASENAME___.mChange the code in to what you want

Additional settings are required for inheriting from custom classes.

  • Change the folder name to the base class name.
  • In TemplateInfo. plist, the Options-> Item 1-> Values-> Item 1 value is changed to the base class name.

Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

Related Article

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.