├── File Templates
└── Personal
│ └── UIKit Class.xctemplate
│ ├── TemplateIcon.png
│ ├── TemplateIcon@2x.png
│ ├── TemplateInfo.plist
│ ├── UIViewControllerObjective-C
│ ├── ___FILEBASENAME___.h
│ └── ___FILEBASENAME___.m
│ ├── UIViewControllerSwift
│ └── ___FILEBASENAME___.swift
│ ├── UIViewObjective-C
│ ├── ___FILEBASENAME___.h
│ └── ___FILEBASENAME___.m
│ └── UIViewSwift
│ └── ___FILEBASENAME___.swift
├── LICENSE.md
├── Project Templates
└── Personal
│ └── Manual Single View App.xctemplate
│ ├── TemplateIcon.png
│ ├── TemplateIcon@2x.png
│ └── TemplateInfo.plist
├── README.md
├── file-templates.png
├── installation.png
└── project-templates.png
/File Templates/Personal/UIKit Class.xctemplate/TemplateIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kharrison/Xcode-Templates/42eed7c89dcd1f31bd722cff1e98902ccf0d740b/File Templates/Personal/UIKit Class.xctemplate/TemplateIcon.png
--------------------------------------------------------------------------------
/File Templates/Personal/UIKit Class.xctemplate/TemplateIcon@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kharrison/Xcode-Templates/42eed7c89dcd1f31bd722cff1e98902ccf0d740b/File Templates/Personal/UIKit Class.xctemplate/TemplateIcon@2x.png
--------------------------------------------------------------------------------
/File Templates/Personal/UIKit Class.xctemplate/TemplateInfo.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Kind
6 | Xcode.IDEFoundation.TextSubstitutionFileTemplateKind
7 | Description
8 | A UIKit class.
9 | Summary
10 | A UIKit class
11 | SortOrder
12 | 1
13 | DefaultCompletionName
14 | MyClass
15 | Platforms
16 |
17 | com.apple.platform.iphoneos
18 |
19 | Options
20 |
21 |
22 | Identifier
23 | productName
24 | Required
25 |
26 | Name
27 | Class:
28 | Description
29 | The name of the class to create
30 | Type
31 | text
32 | NotPersisted
33 |
34 |
35 |
36 | Identifier
37 | cocoaTouchSubclass
38 | Required
39 | YES
40 | Name
41 | Subclass of:
42 | Description
43 | What class to subclass in the new file
44 | Type
45 | class
46 | Default
47 | UIView
48 | FallbackHeader
49 | import UIKit
50 | Values
51 |
52 | UIView
53 | UIViewController
54 |
55 | Suffixes
56 |
57 | UIViewController
58 | ViewController
59 |
60 |
61 |
62 | Identifier
63 | XIB
64 | Name
65 | Also create XIB file
66 | Description
67 | Whether to create a XIB file with the same name
68 | Type
69 | checkbox
70 | RequiredOptions
71 |
72 | cocoaTouchSubclass
73 |
74 | UIViewController
75 |
76 |
77 | Default
78 | false
79 | NotPersisted
80 |
81 |
82 |
83 | Identifier
84 | languageChoice
85 | Required
86 |
87 | Name
88 | Language:
89 | Description
90 | The implementation language
91 | Type
92 | popup
93 | Default
94 | Swift
95 | Values
96 |
97 | Swift
98 | Objective-C
99 |
100 | MainTemplateFiles
101 |
102 | Swift
103 | ___FILEBASENAME___.swift
104 | Objective-C
105 | ___FILEBASENAME___.m
106 |
107 | AllowedTypes
108 |
109 | Swift
110 |
111 | public.swift-source
112 |
113 | Objective-C
114 |
115 | public.objective-c-source
116 | public.objective-c-plus-plus-source
117 |
118 |
119 |
120 |
121 |
122 |
123 |
--------------------------------------------------------------------------------
/File Templates/Personal/UIKit Class.xctemplate/UIViewControllerObjective-C/___FILEBASENAME___.h:
--------------------------------------------------------------------------------
1 | //___FILEHEADER___
2 |
3 | ___IMPORTHEADER_cocoaTouchSubclass___
4 |
5 | @interface ___FILEBASENAMEASIDENTIFIER___ : ___VARIABLE_cocoaTouchSubclass___
6 |
7 | @end
8 |
--------------------------------------------------------------------------------
/File Templates/Personal/UIKit Class.xctemplate/UIViewControllerObjective-C/___FILEBASENAME___.m:
--------------------------------------------------------------------------------
1 | //___FILEHEADER___
2 |
3 | #import "___FILEBASENAME___.h"
4 |
5 | @interface ___FILEBASENAMEASIDENTIFIER___ ()
6 |
7 | @end
8 |
9 | @implementation ___FILEBASENAMEASIDENTIFIER___
10 |
11 | - (void)viewDidLoad {
12 | [super viewDidLoad];
13 | [self setupView];
14 | }
15 |
16 | - (void)setupView {
17 | }
18 |
19 | @end
20 |
--------------------------------------------------------------------------------
/File Templates/Personal/UIKit Class.xctemplate/UIViewControllerSwift/___FILEBASENAME___.swift:
--------------------------------------------------------------------------------
1 | //___FILEHEADER___
2 |
3 | import UIKit
4 |
5 | final class ___FILEBASENAMEASIDENTIFIER___: ___VARIABLE_cocoaTouchSubclass___ {
6 | override func viewDidLoad() {
7 | super.viewDidLoad()
8 | setupView()
9 | }
10 |
11 | private func setupView() {
12 |
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/File Templates/Personal/UIKit Class.xctemplate/UIViewObjective-C/___FILEBASENAME___.h:
--------------------------------------------------------------------------------
1 | //___FILEHEADER___
2 |
3 | ___IMPORTHEADER_cocoaTouchSubclass___
4 |
5 | @interface ___FILEBASENAMEASIDENTIFIER___ : ___VARIABLE_cocoaTouchSubclass___
6 |
7 | @end
8 |
--------------------------------------------------------------------------------
/File Templates/Personal/UIKit Class.xctemplate/UIViewObjective-C/___FILEBASENAME___.m:
--------------------------------------------------------------------------------
1 | //___FILEHEADER___
2 |
3 | #import "___FILEBASENAME___.h"
4 |
5 | @implementation ___FILEBASENAMEASIDENTIFIER___
6 |
7 | - (instancetype)initWithFrame:(CGRect)frame {
8 | self = [super initWithFrame:frame];
9 | if (self) {
10 | [self commonSetup];
11 | }
12 | return self;
13 | }
14 |
15 | - (instancetype)initWithCoder:(NSCoder *)coder {
16 | self = [super initWithCoder:coder];
17 | if (self) {
18 | [self commonSetup];
19 | }
20 | return self;
21 | }
22 |
23 | - (void)commonSetup {
24 | }
25 |
26 | @end
27 |
--------------------------------------------------------------------------------
/File Templates/Personal/UIKit Class.xctemplate/UIViewSwift/___FILEBASENAME___.swift:
--------------------------------------------------------------------------------
1 | //___FILEHEADER___
2 |
3 | import UIKit
4 |
5 | final class ___FILEBASENAMEASIDENTIFIER___: ___VARIABLE_cocoaTouchSubclass___ {
6 | override init(frame: CGRect) {
7 | super.init(frame: frame)
8 | setupView()
9 | }
10 |
11 | required init?(coder aDecoder: NSCoder) {
12 | super.init(coder: aDecoder)
13 | setupView()
14 | }
15 |
16 | private func setupView() {
17 | // Add views and constraints
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | ## License
2 |
3 | Copyright (c) 2018 Keith Harrison.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 |
9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
10 |
11 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
12 |
13 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
14 | POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------------
/Project Templates/Personal/Manual Single View App.xctemplate/TemplateIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kharrison/Xcode-Templates/42eed7c89dcd1f31bd722cff1e98902ccf0d740b/Project Templates/Personal/Manual Single View App.xctemplate/TemplateIcon.png
--------------------------------------------------------------------------------
/Project Templates/Personal/Manual Single View App.xctemplate/TemplateIcon@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kharrison/Xcode-Templates/42eed7c89dcd1f31bd722cff1e98902ccf0d740b/Project Templates/Personal/Manual Single View App.xctemplate/TemplateIcon@2x.png
--------------------------------------------------------------------------------
/Project Templates/Personal/Manual Single View App.xctemplate/TemplateInfo.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleIdentifier
6 |
7 | Kind
8 | Xcode.Xcode3.ProjectTemplateUnitKind
9 | Identifier
10 | com.useyourloaf.dt.unit.manual.singleViewApplication
11 | Ancestors
12 |
13 | com.apple.dt.unit.cocoaTouchApplicationBase
14 | com.apple.dt.unit.coreDataCocoaTouchApplication
15 |
16 | Concrete
17 |
18 | Description
19 | This template provides a starting point for an application that uses a single view. It provides a view controller to manage the view. The app delegate create the main window and root view controller (no Storyboard).
20 | SortOrder
21 | 1
22 | Options
23 |
24 |
25 | Identifier
26 | rootClassName
27 | Required
28 |
29 | Name
30 | Root View Controller Class:
31 | Description
32 | Class name of root view controller
33 | Type
34 | text
35 | Default
36 | RootViewController
37 |
38 |
39 | Identifier
40 | languageChoice
41 | Units
42 |
43 | Objective-C
44 |
45 | Nodes
46 |
47 | AppDelegate.m:imports:importHeader:___VARIABLE_rootClassName___.h
48 | ___VARIABLE_rootClassName___.h:comments
49 | ___VARIABLE_rootClassName___.h:imports:importCocoa
50 | ___VARIABLE_rootClassName___.h:interface(___FILEBASENAME___ : UIViewController)
51 | ___VARIABLE_rootClassName___.m:comments
52 | ___VARIABLE_rootClassName___.m:imports:importHeader:___VARIABLE_rootClassName___.h
53 | ___VARIABLE_rootClassName___.m:extension
54 | ___VARIABLE_rootClassName___.m:implementation:methods:viewDidLoad(- (void\)viewDidLoad)
55 | ___VARIABLE_rootClassName___.m:implementation:methods:viewDidLoad:super
56 |
57 |
58 | Swift
59 |
60 | Nodes
61 |
62 | ___VARIABLE_rootClassName___.swift:comments
63 | ___VARIABLE_rootClassName___.swift:imports:importCocoa
64 | ___VARIABLE_rootClassName___.swift:implementation(___FILEBASENAME___: UIViewController)
65 | ___VARIABLE_rootClassName___.swift:implementation:methods:viewDidLoad(override func viewDidLoad(\))
66 | ___VARIABLE_rootClassName___.swift:implementation:methods:viewDidLoad:super
67 |
68 |
69 |
70 |
71 |
72 | Identifier
73 | navigationController
74 | Name
75 | Embed in Navigation Controller
76 | Description
77 | Is the root view controller embedded in a navigation controller
78 | Type
79 | checkbox
80 | Default
81 | false
82 | Units
83 |
84 | false
85 |
86 |
87 | RequiredOptions
88 |
89 | languageChoice
90 | Objective-C
91 |
92 | Definitions
93 |
94 | AppDelegate.m:implementation:methods:applicationdidFinishLaunchingWithOptions:body
95 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen.mainScreen bounds]];
96 | self.window.backgroundColor = UIColor.whiteColor;
97 | self.window.rootViewController = [[___VARIABLE_rootClassName___ alloc] init];
98 | [self.window makeKeyAndVisible];
99 |
100 |
101 |
102 | RequiredOptions
103 |
104 | languageChoice
105 | Swift
106 |
107 | Definitions
108 |
109 | AppDelegate.swift:implementation:methods:applicationdidFinishLaunchingWithOptions:body
110 | window = UIWindow(frame: UIScreen.main.bounds)
111 | window?.backgroundColor = .white
112 | window?.rootViewController = ___VARIABLE_rootClassName___()
113 | window?.makeKeyAndVisible()
114 |
115 |
116 |
117 | true
118 |
119 |
120 | RequiredOptions
121 |
122 | languageChoice
123 | Objective-C
124 |
125 | Definitions
126 |
127 | AppDelegate.m:implementation:methods:applicationdidFinishLaunchingWithOptions:body
128 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen.mainScreen bounds]];
129 | self.window.backgroundColor = UIColor.whiteColor;
130 | ___VARIABLE_rootClassName___ *rootViewController = [[___VARIABLE_rootClassName___ alloc] init];
131 | UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:rootViewController];
132 | self.window.rootViewController = navigationController;
133 | [self.window makeKeyAndVisible];
134 |
135 |
136 |
137 | RequiredOptions
138 |
139 | languageChoice
140 | Swift
141 |
142 | Definitions
143 |
144 | AppDelegate.swift:implementation:methods:applicationdidFinishLaunchingWithOptions:body
145 | window = UIWindow(frame: UIScreen.main.bounds)
146 | window?.backgroundColor = .white
147 | let rootViewController = ___VARIABLE_rootClassName___()
148 | let navigationController = UINavigationController(rootViewController: rootViewController)
149 | window?.rootViewController = navigationController
150 | window?.makeKeyAndVisible()
151 |
152 |
153 |
154 |
155 |
156 |
157 | Definitions
158 |
159 | *:implementation:methods:applicationWillResignActive:comments
160 |
161 | *:implementation:methods:applicationDidEnterBackground:comments
162 |
163 | *:implementation:methods:applicationWillEnterForeground:comments
164 |
165 | *:implementation:methods:applicationDidBecomeActive:comments
166 |
167 | *:implementation:methods:applicationWillTerminate:comments
168 |
169 |
170 |
171 |
172 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## Xcode File And Project Templates
2 |
3 | This repository contains custom Xcode file and project templates. See below for a full description and installation details.
4 |
5 | ### Project Templates
6 |
7 | The project templates appear in a `Personal` group in the template browser. You can change the name of this group by changing the installation folder.
8 |
9 |
10 |
11 | + **Manual Single View App:** This template builds on the Xcode single view app template but does not use a Storyboard. It creates the window and root view controller manually in the App Delegate. Project options allow you to choose the name of the view controller class and whether to embed it in a navigation controller.
12 |
13 | ### File Templates
14 |
15 | The file templates appear in a `Personal` group in the template browser. You can change the name of this group by changing the installation folder.
16 |
17 |
18 |
19 | + **UIKit Class:** Custom `UIView` and `UIViewController` file templates that call a private `setupView` method to add views and constraints. The configuration options are similar to the default Cocoa Touch Class file templates.
20 |
21 | ### Installation
22 |
23 | 1. If it does not yet exist create the `Project Templates` and `File Templates` folders under your home directory:
24 |
25 | $ mkdir -p ~/Library/Developer/Xcode/Templates/Project\ Templates
26 | $ mkdir -p ~/Library/Developer/Xcode/Templates/Files\ Templates
27 |
28 | 2. Copy the contents of the `Project Templates` and `File Templates` folders in this repository into the above folders.
29 |
30 | 3. The templates appear in the Xcode file and project template browsers under a `Personal` group. You can change the name of this group by renaming the installation folder in the `File Templates` or `Project Templates` folders:
31 |
32 |
33 | ### Further Details
34 |
35 | See this blog post for more details on creating custom Xcode project templates:
36 |
37 | + [Creating Custom Xcode Project Templates](https://useyourloaf.com/blog/creating-custom-xcode-project-templates/)
38 |
--------------------------------------------------------------------------------
/file-templates.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kharrison/Xcode-Templates/42eed7c89dcd1f31bd722cff1e98902ccf0d740b/file-templates.png
--------------------------------------------------------------------------------
/installation.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kharrison/Xcode-Templates/42eed7c89dcd1f31bd722cff1e98902ccf0d740b/installation.png
--------------------------------------------------------------------------------
/project-templates.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kharrison/Xcode-Templates/42eed7c89dcd1f31bd722cff1e98902ccf0d740b/project-templates.png
--------------------------------------------------------------------------------