Permalink
Browse files

added some snippets like editor in Xcode

  • Loading branch information...
1 parent 80f50e9 commit 9394f8fea9f9f71950784b9b663087e6bb68500b @marutanm marutanm committed with Mar 22, 2010
Showing with 77 additions and 0 deletions.
  1. +77 −0 snippets/objc.snippets
View
@@ -33,16 +33,31 @@ snippet int
}
${4}
@end
+snippet @interface
+ @interface ${1:`Filename('', 'someClass')`} : ${2:NSObject}
+ {${3}
+ }
+ ${4}
+ @end
# Class Implementation
snippet impl
@implementation ${1:`Filename('', 'someClass')`}
${2}
@end
+snippet @implementation
+ @implementation ${1:`Filename('', 'someClass')`}
+ ${2}
+ @end
# Protocol
snippet pro
@protocol ${1:`Filename('$1Delegate', 'MyProtocol')`} ${2:<NSObject>}
${3}
@end
+snippet @protocol
+ @protocol ${1:`Filename('$1Delegate', 'MyProtocol')`} ${2:<NSObject>}
+ ${3}
+ @end
+# init Definition
snippet init
- (id)init
{
@@ -51,6 +66,13 @@ snippet init
}
return self;
}
+# dealloc Definition
+snippet dealloc
+ - (void) dealloc
+ {
+ ${1:deallocations}
+ [super dealloc];
+ }
snippet su
[super ${1:init}]${2}
snippet ibo
@@ -124,13 +146,43 @@ snippet forin
for (${1:Class} *${2:some$1} in ${3:array}) {
${4}
}
+snippet fore
+ for (${1:object} in ${2:array}) {
+ ${3:statements}
+ }
snippet forarray
unsigned int ${1:object}Count = [${2:array} count];
for (unsigned int index = 0; index < $1Count; index++) {
${3:id} $1 = [$2 $1AtIndex:index];
${4}
}
+snippet fora
+ unsigned int ${1:object}Count = [${2:array} count];
+
+ for (unsigned int index = 0; index < $1Count; index++) {
+ ${3:id} $1 = [$2 $1AtIndex:index];
+ ${4}
+ }
+# Try / Catch Block
+snippet @try
+ @try {
+ ${1:statements}
+ }
+ @catch (NSException * e) {
+ ${2:handler}
+ }
+ @finally {
+ ${3:statements}
+ }
+snippet @catch
+ @catch (${1:exception}) {
+ ${2:handler}
+ }
+snippet @finally
+ @finally {
+ ${1:statements}
+ }
# IBOutlet
# @property (Objective-C 2.0)
snippet prop
@@ -141,6 +193,8 @@ snippet syn
# [[ alloc] init]
snippet alloc
[[${1:foo} alloc] init${2}];${3}
+snippet a
+ [[${1:foo} alloc] init${2}];${3}
# retain
snippet ret
[${1:foo} retain];${2}
@@ -168,3 +222,26 @@ snippet cl
@class ${1:Foo};${2}
snippet color
[[NSColor ${1:blackColor}] set];
+# NSArray
+snippet array
+ NSMutableArray *${1:array} = [NSMutable array];${2}
+snippet nsa
+ NSArray ${1}
+snippet nsma
+ NSMutableArray ${1}
+snippet aa
+ NSArray * array;${1}
+snippet ma
+ NSMutableArray * array;${1}
+# NSDictionary
+snippet dict
+ NSMutableDictionary *${1:dict} = [NSMutableDictionary dictionary];${2}
+snippet nsd
+ NSDictionary ${1}
+snippet nsmd
+ NSMutableDictionary ${1}
+# NSString
+snippet nss
+ NSString ${1}
+snippet nsms
+ NSMutableString ${1}

0 comments on commit 9394f8f

Please sign in to comment.