简体   繁体   中英

How do I create a template subclass file in xcode?

I'm creating a static library for other developers. Some of the classes are meant to be overridden, similar to UIKit classes like UITableViewController.

How do I create templates that will automatically be filled in after the developer creates a new subclass of my class? For example, when they create XXController using xcode's file->new method, I want the subclassed file to contain some boiler plate code that I specify.

If you are making use of Xcode 4 its difficult to create templates. See instructions here http://blog.boreal-kiss.net/2011/03/11/a-minimal-project-template-for-xcode-4/ Also checkout https://github.com/MrGando/Xcode-4-Template-Generator which is a python script which helps to build a very basic TemplateInfo.plist.

Have you considered using IntelliJ's AppCode which has bare-bones but much easier template creation feature.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM