]>
Commit | Line | Data |
---|---|---|
0d23b6e5 BB |
1 | # #import <...> |
2 | snippet Imp | |
3 | #import <${1:Cocoa/Cocoa.h}>${2} | |
4 | # #import "..." | |
5 | snippet imp | |
6 | #import "${1:`Filename()`.h}"${2} | |
7 | # @selector(...) | |
8 | snippet sel | |
9 | @selector(${1:method}:)${3} | |
10 | # @"..." string | |
11 | snippet s | |
12 | @"${1}"${2} | |
13 | # Object | |
14 | snippet o | |
15 | ${1:NSObject} *${2:foo} = [${3:$1 alloc}]${4};${5} | |
16 | # NSLog(...) | |
17 | snippet log | |
18 | NSLog(@"${1:%@}"${2});${3} | |
19 | # Class | |
20 | snippet objc | |
21 | @interface ${1:`Filename('', 'someClass')`} : ${2:NSObject} | |
22 | { | |
23 | } | |
24 | @end | |
25 | ||
26 | @implementation $1 | |
27 | ${3} | |
28 | @end | |
29 | # Class Interface | |
30 | snippet int | |
31 | @interface ${1:`Filename('', 'someClass')`} : ${2:NSObject} | |
32 | {${3} | |
33 | } | |
34 | ${4} | |
35 | @end | |
36 | snippet @interface | |
37 | @interface ${1:`Filename('', 'someClass')`} : ${2:NSObject} | |
38 | {${3} | |
39 | } | |
40 | ${4} | |
41 | @end | |
42 | # Class Implementation | |
43 | snippet impl | |
44 | @implementation ${1:`Filename('', 'someClass')`} | |
45 | ${2} | |
46 | @end | |
47 | snippet @implementation | |
48 | @implementation ${1:`Filename('', 'someClass')`} | |
49 | ${2} | |
50 | @end | |
51 | # Protocol | |
52 | snippet pro | |
53 | @protocol ${1:`Filename('$1Delegate', 'MyProtocol')`} ${2:<NSObject>} | |
54 | ${3} | |
55 | @end | |
56 | snippet @protocol | |
57 | @protocol ${1:`Filename('$1Delegate', 'MyProtocol')`} ${2:<NSObject>} | |
58 | ${3} | |
59 | @end | |
60 | # init Definition | |
61 | snippet init | |
62 | - (id)init | |
63 | { | |
64 | if (self = [super init]) { | |
65 | ${1} | |
66 | } | |
67 | return self; | |
68 | } | |
69 | # dealloc Definition | |
70 | snippet dealloc | |
71 | - (void) dealloc | |
72 | { | |
73 | ${1:deallocations} | |
74 | [super dealloc]; | |
75 | } | |
76 | snippet su | |
77 | [super ${1:init}]${2} | |
78 | snippet ibo | |
79 | IBOutlet ${1:NSSomeClass} *${2:$1};${3} | |
80 | # Category | |
81 | snippet cat | |
82 | @interface ${1:NSObject} (${2:MyCategory}) | |
83 | @end | |
84 | ||
85 | @implementation $1 ($2) | |
86 | ${3} | |
87 | @end | |
88 | # Category Interface | |
89 | snippet cath | |
90 | @interface ${1:`Filename('$1', 'NSObject')`} (${2:MyCategory}) | |
91 | ${3} | |
92 | @end | |
93 | # Method | |
94 | snippet m | |
95 | - (${1:id})${2:method} | |
96 | { | |
97 | ${3} | |
98 | } | |
99 | # Method declaration | |
100 | snippet md | |
101 | - (${1:id})${2:method};${3} | |
102 | # IBAction declaration | |
103 | snippet ibad | |
104 | - (IBAction)${1:method}:(${2:id})sender;${3} | |
105 | # IBAction method | |
106 | snippet iba | |
107 | - (IBAction)${1:method}:(${2:id})sender | |
108 | { | |
109 | ${3} | |
110 | } | |
111 | # awakeFromNib method | |
112 | snippet wake | |
113 | - (void)awakeFromNib | |
114 | { | |
115 | ${1} | |
116 | } | |
117 | # Class Method | |
118 | snippet M | |
119 | + (${1:id})${2:method} | |
120 | { | |
121 | ${3:return nil;} | |
122 | } | |
123 | # Sub-method (Call super) | |
124 | snippet sm | |
125 | - (${1:id})${2:method} | |
126 | { | |
127 | [super $2];${3} | |
128 | return self; | |
129 | } | |
130 | # Accessor Methods For: | |
131 | # Object | |
132 | snippet objacc | |
133 | - (${1:id})${2:thing} | |
134 | { | |
135 | return $2; | |
136 | } | |
137 | ||
138 | - (void)set$2:($1)${3:new$2} | |
139 | { | |
140 | [$3 retain]; | |
141 | [$2 release]; | |
142 | $2 = $3; | |
143 | }${4} | |
144 | # for (object in array) | |
145 | snippet forin | |
146 | for (${1:Class} *${2:some$1} in ${3:array}) { | |
147 | ${4} | |
148 | } | |
149 | snippet fore | |
150 | for (${1:object} in ${2:array}) { | |
151 | ${3:statements} | |
152 | } | |
153 | snippet forarray | |
154 | unsigned int ${1:object}Count = [${2:array} count]; | |
155 | ||
156 | for (unsigned int index = 0; index < $1Count; index++) { | |
157 | ${3:id} $1 = [$2 $1AtIndex:index]; | |
158 | ${4} | |
159 | } | |
160 | snippet fora | |
161 | unsigned int ${1:object}Count = [${2:array} count]; | |
162 | ||
163 | for (unsigned int index = 0; index < $1Count; index++) { | |
164 | ${3:id} $1 = [$2 $1AtIndex:index]; | |
165 | ${4} | |
166 | } | |
167 | # Try / Catch Block | |
168 | snippet @try | |
169 | @try { | |
170 | ${1:statements} | |
171 | } | |
172 | @catch (NSException * e) { | |
173 | ${2:handler} | |
174 | } | |
175 | @finally { | |
176 | ${3:statements} | |
177 | } | |
178 | snippet @catch | |
179 | @catch (${1:exception}) { | |
180 | ${2:handler} | |
181 | } | |
182 | snippet @finally | |
183 | @finally { | |
184 | ${1:statements} | |
185 | } | |
186 | # IBOutlet | |
187 | # @property (Objective-C 2.0) | |
188 | snippet prop | |
189 | @property (${1:retain}) ${2:NSSomeClass} ${3:*$2};${4} | |
190 | # @synthesize (Objective-C 2.0) | |
191 | snippet syn | |
192 | @synthesize ${1:property};${2} | |
193 | # [[ alloc] init] | |
194 | snippet alloc | |
195 | [[${1:foo} alloc] init${2}];${3} | |
196 | snippet a | |
197 | [[${1:foo} alloc] init${2}];${3} | |
198 | # retain | |
199 | snippet ret | |
200 | [${1:foo} retain];${2} | |
201 | # release | |
202 | snippet rel | |
203 | [${1:foo} release]; | |
204 | # autorelease | |
205 | snippet arel | |
206 | [${1:foo} autorelease]; | |
207 | # autorelease pool | |
208 | snippet pool | |
209 | NSAutoreleasePool *${1:pool} = [[NSAutoreleasePool alloc] init]; | |
210 | ${2:/* code */} | |
211 | [$1 drain]; | |
212 | # Throw an exception | |
213 | snippet except | |
214 | NSException *${1:badness}; | |
215 | $1 = [NSException exceptionWithName:@"${2:$1Name}" | |
216 | reason:@"${3}" | |
217 | userInfo:nil]; | |
218 | [$1 raise]; | |
219 | snippet prag | |
220 | #pragma mark ${1:-} | |
221 | snippet cl | |
222 | @class ${1:Foo};${2} | |
223 | snippet color | |
224 | [[NSColor ${1:blackColor}] set]; | |
225 | # NSArray | |
226 | snippet array | |
227 | NSMutableArray *${1:array} = [NSMutable array];${2} | |
228 | snippet nsa | |
229 | NSArray ${1} | |
230 | snippet nsma | |
231 | NSMutableArray ${1} | |
232 | snippet aa | |
233 | NSArray * array;${1} | |
234 | snippet ma | |
235 | NSMutableArray * array;${1} | |
236 | # NSDictionary | |
237 | snippet dict | |
238 | NSMutableDictionary *${1:dict} = [NSMutableDictionary dictionary];${2} | |
239 | snippet nsd | |
240 | NSDictionary ${1} | |
241 | snippet nsmd | |
242 | NSMutableDictionary ${1} | |
243 | # NSString | |
244 | snippet nss | |
245 | NSString ${1} | |
246 | snippet nsms | |
247 | NSMutableString ${1} |