@@ -18,7 +18,7 @@ To run this script automatically before each commit, install the pre-commit hook
18
18
19
19
## Snippet Descriptions
20
20
21
- ** addAChildViewcontroller .codesnippet** (Add a child ViewController)
21
+ ** objc_addAChildViewcontroller .codesnippet** (Add a child ViewController)
22
22
Language: ` Obj-C `
23
23
Shortcut: ` childController `
24
24
Adds a child ViewController to self
@@ -29,7 +29,7 @@ Adds a child ViewController to self
29
29
[self.contentView addSubview:newController.view];
30
30
[newController didMoveToParentViewController:self];
31
31
32
- ** createAReusableTablecell .codesnippet** (Create a reusable TableCell)
32
+ ** objc_createAReusableTablecell .codesnippet** (Create a reusable TableCell)
33
33
Language: ` Obj-C `
34
34
Shortcut: ` tablecell `
35
35
Initialises / deques a new cell from the tableview using an identifier
@@ -43,14 +43,14 @@ Initialises / deques a new cell from the tableview using an identifier
43
43
44
44
return cell;
45
45
46
- ** createAnImageview .codesnippet** (Create an imageView)
46
+ ** objc_createAnImageview .codesnippet** (Create an imageView)
47
47
Language: ` Obj-C `
48
48
Shortcut: ` iv `
49
49
Inits a new imageView with an image via imageNamed.
50
50
51
51
[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"<#imageName#>"]]
52
52
53
- ** createAndShowAUialertview .codesnippet** (Create & show a UIAlertView)
53
+ ** objc_createAndShowAUialertview .codesnippet** (Create & show a UIAlertView)
54
54
Language: ` Obj-C `
55
55
Shortcut: ` alertview `
56
56
Shows a newly created alertview
@@ -61,7 +61,7 @@ Shows a newly created alertview
61
61
cancelButtonTitle:<#nil#>
62
62
otherButtonTitles:<#nil#>] show];
63
63
64
- ** decrementingForLoop .codesnippet** (Decrementing For Loop)
64
+ ** objc_decrementingForLoop .codesnippet** (Decrementing For Loop)
65
65
Language: ` Obj-C `
66
66
Shortcut: ` fori `
67
67
A For Loop decrementing a local variable
@@ -70,14 +70,14 @@ A For Loop decrementing a local variable
70
70
<#statements#>
71
71
}
72
72
73
- ** formattedString .codesnippet** (Formatted String)
73
+ ** objc_formattedString .codesnippet** (Formatted String)
74
74
Language: ` Obj-C `
75
75
Shortcut: ` format `
76
76
Shortcut for a formatted string
77
77
78
78
[NSString stringWithFormat:@"<#string#>", <#param1#>]
79
79
80
- ** getDocumentsDirectory .codesnippet** (Get Documents directory)
80
+ ** objc_getDocumentsDirectory .codesnippet** (Get Documents directory)
81
81
Language: ` Obj-C `
82
82
Shortcut: ` documents `
83
83
Create path to documents directory
@@ -86,28 +86,21 @@ Create path to documents directory
86
86
NSString *documentsDirectory = [paths objectAtIndex:0];
87
87
NSString *filePath = [documentsDirectory stringByAppendingPathComponent:@"<#fileName#>"];
88
88
89
- ** guardWeakSelf.codesnippet** (Guard Weak Self)
90
- Language: ` Swift `
91
- Shortcut: ` ws `
92
- Guard weak self to exist
93
-
94
- guard let self = self else { return <#returnValue#> }
95
-
96
- ** importFramework.codesnippet** (Import Framework)
89
+ ** objc_importFramework.codesnippet** (Import Framework)
97
90
Language: ` Obj-C `
98
91
Shortcut: ` imp2 `
99
92
import a framework
100
93
101
94
#import <<#header#>>
102
95
103
- ** importHeader .codesnippet** (Import header)
96
+ ** objc_importHeader .codesnippet** (Import header)
104
97
Language: ` Obj-C `
105
98
Shortcut: ` imp1 `
106
99
Import a header
107
100
108
101
#import "<#header#>"
109
102
110
- ** incrementingForLoop .codesnippet** (Incrementing For Loop)
103
+ ** objc_incrementingForLoop .codesnippet** (Incrementing For Loop)
111
104
Language: ` Obj-C `
112
105
Shortcut: ` fori `
113
106
A For loop incrementing a local variable
@@ -116,59 +109,50 @@ A For loop incrementing a local variable
116
109
<#statements#>
117
110
}
118
111
119
- ** initalizeAnObject .codesnippet** (Initalize an object)
112
+ ** objc_initalizeAnObject .codesnippet** (Initalize an object)
120
113
Language: ` Obj-C `
121
114
Shortcut: ` alloc `
122
115
creates a new object from a given class
123
116
124
117
<#ClassName#> *<#variableName#> = [[<#ClassName#> alloc] init];
125
118
126
- ** keyValuePairForLocalization .codesnippet** (Key-Value Pair for Localization)
119
+ ** objc_keyValuePairForLocalization .codesnippet** (Key-Value Pair for Localization)
127
120
Language: ` Obj-C `
128
121
Shortcut: ` key `
129
122
A localization key and its value
130
123
131
124
"<#keyName#>" = "<#value#>";
132
125
133
- ** localizeAString .codesnippet** (Localize a string)
126
+ ** objc_localizeAString .codesnippet** (Localize a string)
134
127
Language: ` Obj-C `
135
128
Shortcut: ` loca `
136
129
Localizes a string from a given key
137
130
138
131
NSLocalizedString(@"<#keyName#>", nil)
139
132
140
- ** pragmaMark .codesnippet** (Pragma mark)
133
+ ** objc_pragmaMark .codesnippet** (Pragma mark)
141
134
Language: ` Obj-C `
142
135
Shortcut: ` pragma `
143
136
Add a new pragma mark
144
137
145
138
#pragma mark <#comment#>
146
139
147
- ** pushAViewcontroller .codesnippet** (Push a ViewController)
140
+ ** objc_pushAViewcontroller .codesnippet** (Push a ViewController)
148
141
Language: ` Obj-C `
149
142
Shortcut: ` push `
150
143
Pushes a newly created ViewController on the current NavigationController
151
144
152
145
<#UIViewController#>* viewController = [[<#UIViewController#> alloc] init];
153
146
[self.navigationController pushViewController:viewController animated:YES];
154
147
155
- ** setupAutoresizingOfAView .codesnippet** (Setup autoresizing of a view)
148
+ ** objc_setupAutoresizingOfAView .codesnippet** (Setup autoresizing of a view)
156
149
Language: ` Obj-C `
157
150
Shortcut: ` autoresizing `
158
151
Set the autoresizing flags of a view
159
152
160
153
<#view#>.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
161
154
162
- ** setupCustomWindowAndVc.codesnippet** (Setup custom window & VC)
163
- Language: ` Swift `
164
- Shortcut: ` setwin `
165
- Create window and rootVC
166
-
167
- window = UIWindow(windowScene: scene)
168
- window?.rootViewController = UINavigationController(rootViewController: <#ViewController#>)
169
- window?.makeKeyAndVisible()
170
-
171
- ** singleton.codesnippet** (singleton)
155
+ ** objc_singleton.codesnippet** (singleton)
172
156
Language: ` Obj-C `
173
157
Shortcut: ` singleton `
174
158
A singleton implementation using dispatch_once
@@ -183,17 +167,33 @@ A singleton implementation using dispatch_once
183
167
return _sharedInstance;
184
168
}
185
169
186
- ** strongSelfPointer .codesnippet** (Strong self pointer)
170
+ ** objc_strongSelfPointer .codesnippet** (Strong self pointer)
187
171
Language: ` Obj-C `
188
172
Shortcut: ` ss `
189
173
A strong pointer to self (for usage in blocks).
190
174
191
175
__strong __typeof(weakSelf) strongSelf = weakSelf;
192
176
193
- ** weakSelfPointer .codesnippet** (Weak self pointer)
177
+ ** objc_weakSelfPointer .codesnippet** (Weak self pointer)
194
178
Language: ` Obj-C `
195
179
Shortcut: ` ws `
196
180
A weak pointer to self (for usage in blocks).
197
181
198
182
__weak __typeof(self) weakSelf = self;
199
183
184
+ ** swift_guardWeakSelf.codesnippet** (Guard Weak Self)
185
+ Language: ` Swift `
186
+ Shortcut: ` ws `
187
+ Guard weak self to exist
188
+
189
+ guard let self = self else { return <#returnValue#> }
190
+
191
+ ** swift_setupCustomWindowAndVc.codesnippet** (Setup custom window & VC)
192
+ Language: ` Swift `
193
+ Shortcut: ` setwin `
194
+ Create window and rootVC
195
+
196
+ window = UIWindow(windowScene: scene)
197
+ window?.rootViewController = UINavigationController(rootViewController: <#ViewController#>)
198
+ window?.makeKeyAndVisible()
199
+
0 commit comments