`
啸笑天
  • 浏览: 3436204 次
  • 性别: Icon_minigender_1
  • 来自: China
社区版块
存档分类
最新评论

File Templates & Project Templates

 
阅读更多

XcodeTemplates

File Templates & Project Templates


文件模板

  • 系统文件模板路径(Xcode7):

    /Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates/File Templates

系统文件模板路径EZ.xctemplate 是我放进入的文件模板(其实只要复制 Cocoa Touch Class.xctemplate模板修改定制成自己的模板),你只要复制EZ.xctemplate到系统文件模板路径下就可以直接使用了。

EZ.xctemplate 文件夹下的EZViewControllerObjective-C,EZViewControllerXibObjective-C,EZViewControllerSwift,EZViewControllerXIBSwift是我增加的文件夹,

UIViewControllerObjective-C,UIViewControllerXIBObjective-C,UIViewControllerSwift,UIViewControllerXIBSwift文件夹做了定制修改。

TemplateIcon.png,TemplateIcon@2x.png,TemplateInfo.plist也做了相应的修改,其它暂时没有定制,

效果如下: 自定义文件模板效果EZViewControllerObjective-C,EZViewControllerXibObjective-C,EZViewControllerSwift,EZViewControllerXIBSwift 文件夹命名规则是:类名+Objective-C/Swift 如果文件夹下有xib文件,在Objective-C/Swift前加Xib

TemplateIcon.png和TemplateIcon@2x.png是模板的icon,大小48*48和96*96

TemplateInfo.plist是模板的配置文件: 模板配置文件1 模板配置文件2 模板配置文件3

Options中得Item0、1、2、3对应下图四个选项: 模板配置文件3

模板代码例子(EZ.xctemplate/EZViewControllerSwift/FILEBASENAME.swift):

//
//  ___FILENAME___
//  ___PROJECTNAME___
//
//  Created by ___FULLUSERNAME___ on ___DATE___.
//___COPYRIGHT___
//

import UIKit

class ___FILEBASENAMEASIDENTIFIER___: ___VARIABLE_cocoaTouchSubclass___ {

// MARK: - Life cycle
required init?(coder aDecoder: NSCoder) {
    fatalError("init(coder:) has not been implemented")
}


override func awakeFromNib() {
    super.awakeFromNib()
}

override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
    super.init(nibName: nil, bundle: nil)
}

override func viewDidLoad() {
    super.viewDidLoad()

    // Do any additional setup after loading the view.
}

override func viewWillAppear(animated: Bool) {
    super.viewWillAppear(animated)
}

override func viewDidLayoutSubviews() {
    super.viewDidLayoutSubviews()
}

override func viewDidAppear(animated: Bool) {
    super.viewDidAppear(animated)
}

override func viewWillDisappear(animated: Bool) {
    super.viewWillDisappear(animated)
}

override func viewDidDisappear(animated: Bool) {
    super.viewDidDisappear(animated)

}


override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}

deinit{
    NSNotificationCenter.defaultCenter().removeObserver(self)
    if self.isViewLoaded(){
        self.view.layer .removeAllAnimations();
    }
}

// MARK: - Config
// MARK: - Public methods
// MARK: - Private methods
// MARK: - Target
// MARK: - Action
// MARK: - Notification

}

项目模板

 

-----------------------------------------------------------------------------------------------------------------------------------------------

 

 代码:https://github.com/easyui/XcodeTemplates

 

thx: 

创建Xcode模板:不过倒是发现了一个Xcode插件,专门用来创建模板的:Stencil: A plugin for Xcode allowing you to easily create custom file templates,以及对应的文章:Introducing Stencil,还有一些教程:How to Create Custom Project Templates in Xcode 7Creating Custom Xcode Templates,读者可自行阅读~

 

http://www.bobmccune.com/2012/03/04/creating-custom-xcode-4-file-templates/

http://zengyi.me/blog/2014/08/13/create-custom-xcode5-project-templates/

 

分享到:
评论

相关推荐

    LLCC68 LoRa Demo v1.0

    - Project/STM32F0xx_StdPeriph_Templates/stm32f0xx_conf.h Library Configuration file - Project/STM32F0xx_StdPeriph_Templates/stm32f0xx_it.c Interrupt handlers - Project/STM32F0xx_StdPeriph_Templates...

    vs2010 如何让创建和使用动态链接库(dll)

    1、打开Microsoft Visual Studio 2010,选择File->New->Project。 2、在New Project中选择Installed Templates->Visual C++->Win32。 3、选择Win32 Console Application,设置名称:simpledll,设置解决方案名:...

    Xcode6CocoaPythonTemplates:用于 Cocoa-Python (PyObjC) 开发的 Xcode 6 模板

    Xcode 6 Cocoa-Python 模板 这是一组用于 Xcode 6 的文件模板和项目模板。这些模板已经在 Mavericks 上使用 Xcode 6.2 进行了测试。 在此处使用 Xcode 3 模板: : 作为起点,并使用... 将 File Templates 和 Project

    Code Edit Studio v1.1(最新版) 支持超过40种开发语言的超级代码

    Support for project files.• Drag and Drop support (open or insert files).• Ability to read and write Delphi binary form files.• Assign to any syntax scheme a custom help file and ...

    Bloodshed Dev-C++

    * added ENTER key for opening file in project browser, DEL to delete from the project. * bug fixes version 4.9.6.3 * Bug fixes version 4.9.6.2 * Bug fixes version 4.9.6.1 * New "Abort compilation" ...

    PowerCommands for Visual Studio 2008

    This command opens the MSBuild project file for a selected project inside Visual Studio. It combines the existing Unload Project and Edit Project commands. Open Containing Folder This command opens ...

    CFM反编译 ColdFusion轻松解密

    CFDECRYPT for Allaire ColdFusion ...Source (cfdecrypt.c) and MS Visual Studio project file (cfdecrypt.dsp) are also provided. You need libdes if you want to compile it yourself.

    Android代码-My-Wallet-V3-Android

    My-Wallet-V3-Android Next-generation HD (BIP...as the official Android Kotlin code style and remove any file header templates. The script may indicate that you need to restart Android Studio for it's

    Blitz3D SDK V1.02 3D游戏引擎

    无功能限制,仅限学习使用,请不要用与商业开发 ...VisualC - Example project and blank project for VisualC++ development VisualCSharp - Example of using Blitz3DSDK in .net environment

    cas-overlay-template-6.4 服务端代码

    ----------------------------使用--------------------------------- gradle-7.3.3 JDK-11 TOMCAT-9 MYSQL-5.7.35 REDIS-5.X ----------------------------实现功能如下------------------------------------ ...

    BlazorServerTailwindTemplate

    Blazor服务器模板将模板添加到Visual Studio 2019 下载/TemplateFile/BlazorServerTailwindTemplateV1.zip 复制到%USERPROFILE%\Documents\Visual Studio 2019\Templates\ProjectTemplates\尾风与gulp引用 建造安装...

    存储模板

    浏览到:目录/开发人员/平台/iPhoneOS.platform/Developer/Library/Xcode/Templates/Project Templates / iOS / Application 粘贴Storage.xctemplate文件夹。使用模板启动Xcode并创建一个新文件( File > New > ...

    python使用Pycharm创建一个Django项目

    File –> New Project 弹出如下窗口: 图中编号1处为项目位置;编号2处为使用的模板语言类型,默认为Django模板语言;编号3处是保存项目页面HTML的文件夹名称,默认为templates;编号4处是应用名,一般根据Web应

    python 应用之Pycharm 新建模板默认添加编码格式-作者-时间等信息【推荐】

    1.打开pycharm,选择File-Settings(Ctrl + Alt + S),再选择Editor–Color&Style–File and Templates–Python-Script 可以使用搜索快速找到”File and Code Templates”,右侧菜单选择”Python Script”,对模板...

    Js+php实现异步拖拽上传文件

    To change this template file, choose Tools | Templates and open the template in the editor. --> <html> <head> <title>TODO supply a title</title> <meta charset=UTF-8

    JavaScript获取某年某月的最后一天附截图

    To change this template file, choose Tools | Templates and open the template in the editor. --> <html> <head> <title>JavaScript获取某年某月的最后一天</title> <meta ...

    JCreator Pro V5.00.016 (Cracked)

    as : Project management, project templates, code-completion, debugger interface, editor with syntax highlighting, wizards and a fully customizable user interface With JCreator you can directly...

    JCreatorV4

    You can create your own project templates. Just follow the examples in the Template directory of JCreator. You can create a project from a template in the new dialogue. The Execute Project command ...

    解决jar发布时的出现D:/export-0.0.1-SNAPSHOT.jar!/BOOT-INF/classes!/static

    springboot获取根目录及资源路径及解决jar发布时的出现D:/export-0.0.1-SNAPSHOT.jar!/BOOT-INF/classes!/static,采用该工具类可在发布成jar时访问到资源文件路径地址

    dwt-django-file-upload:使用Django上传图像文件

    基本步骤创建一个新的Django项目django-admin startproject project 。 创建一个应用程序python manage.py startapp application 。 在项目根目录下创建一个文件夹模板。 在settings.py中声明目录[os.path.join(BASE...

Global site tag (gtag.js) - Google Analytics