diff --git a/snippets/objc.snippets b/snippets/objc.snippets index 0f5dfd1..1fb6f15 100644 --- a/snippets/objc.snippets +++ b/snippets/objc.snippets @@ -7,6 +7,9 @@ snippet Imp # @selector(...) snippet sel @selector(${1:method}:)${3} +# @"..." string +snippet s + @"${1}"${2} # NSLog(...) snippet log NSLog(@"${1}"${2});${3} @@ -21,13 +24,29 @@ snippet objc - (id) init { if (self = [super init]) + {${3} + } + return self; + } + @end # Class Interface snippet clh - @interface ${1:ClassName} : ${2:NSObject} + @interface ${1:`Filename('', 'object')`} : ${2:NSObject} {${3} } ${4} @end +# Class Implementation +snippet clm + @implementation ${1:`Filename('', 'object')`} : ${2:NSObject} + - (id)init + { + if ((self = [super init])) + {$0 + } + return self; + } + @end snippet ibo IBOutlet ${1:NSSomeClass} *${2:$1}; # Category @@ -61,6 +80,21 @@ snippet m # Method declaration snippet md - (${1:id})${2:method};${3} +# IBAction declaration +snippet ibad + - (IBAction)${1:method};${2} +# IBAction method +snippet iba + - (IBAction)${1:method} + { + ${2} + } +# awakeFromNib method +snippet wake + - (void)awakeFromNib + { + ${1} + } # Class Method snippet M + (${1:id})${2:method} @@ -96,6 +130,11 @@ snippet objacc $2 = [aValue retain]; [old$2 release]; } +# for (object in array) +snippet fora + for (${1:Class} *${2:Object} in ${3:array}) { + ${4} + } snippet forarray unsigned int ${1:object}Count = [${2:array} count]; @@ -119,4 +158,8 @@ snippet ret [${1:foo} retain];${2} # release snippet rel - [${1:foo} release];${2} + [${1:foo} release]; + ${2:$1 = nil;} +# autorelease +snippet arel + [${1:foo} autorelease];