mirror of
https://github.com/joaotavora/yasnippet.git
synced 2026-02-05 15:02:26 +00:00
adding objc-snippets
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: forarray
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: NSArray Loop
|
||||
## condition: "source.objc, source.objc++"
|
||||
# --
|
||||
unsigned int ${1:object}Count = [${2:array} count];
|
||||
|
||||
for(unsigned int index = 0; index < ${1}Count; index += 1)
|
||||
{
|
||||
${3:id} ${1} = [$2 objectAtIndex:index];
|
||||
$0
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: delegate
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Delegate Responds to Selector
|
||||
## condition: "source.objc, source.objc++"
|
||||
# --
|
||||
if([${1:[self delegate]} respondsToSelector:@selector(${2:selfDidSomething:})])
|
||||
[$1 ${3:${2/((^\s*([A-Za-z0-9_]*:)\s*)|(:\s*$)|(:\s*))/(?2:$2self :\:<>)(?4::)(?5: :)/g}}];
|
||||
9
extras/imported/objc-mode/Idioms/Lock Focus.yasnippet
Normal file
9
extras/imported/objc-mode/Idioms/Lock Focus.yasnippet
Normal file
@@ -0,0 +1,9 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: focus
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Lock Focus
|
||||
## condition: "source.objc, source.objc++"
|
||||
# --
|
||||
[self lockFocus];
|
||||
$0
|
||||
[self unlockFocus];
|
||||
@@ -0,0 +1,9 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: pool
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: NSAutoreleasePool
|
||||
## condition: "source.objc, source.objc++"
|
||||
# --
|
||||
NSAutoreleasePool${TM_C_POINTER: *}pool = [NSAutoreleasePool new];
|
||||
$0
|
||||
[pool drain];
|
||||
@@ -0,0 +1,11 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: responds
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Responds to Selector
|
||||
## condition: "source.objc, source.objc++"
|
||||
# --
|
||||
${TM_COMMENT_START} ${4:Send $2 to $1, if $1 supports it}${TM_COMMENT_END}
|
||||
if ([${1:self} respondsToSelector:@selector(${2:someSelector:})])
|
||||
{
|
||||
[$1 ${3:${2/((:\s*$)|(:\s*))/:<>(?3: )/g}}];
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: gsave
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Save and Restore Graphics Context
|
||||
## condition: "source.objc, source.objc++"
|
||||
# --
|
||||
[NSGraphicsContext saveGraphicsState];
|
||||
$0
|
||||
[NSGraphicsContext restoreGraphicsState];
|
||||
Reference in New Issue
Block a user