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___.h
Change the code in to what you want
___FILEBASENAME___.m
Change 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.