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
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