mirror of
https://github.com/joaotavora/yasnippet.git
synced 2026-02-05 06:52:26 +00:00
adding objc-snippets
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: thread
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Detach New NSThread
|
||||
## condition: "source.objc, source.objc++"
|
||||
# --
|
||||
[NSThread detachNewThreadSelector:@selector(${1:method}:) toTarget:${2:aTarget} withObject:${3:anArgument}]
|
||||
@@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: bind
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Bind Property to Key Path of Object
|
||||
## condition: "source.objc, source.objc++"
|
||||
# --
|
||||
bind:@"${2:binding}" toObject:${3:observableController} withKeyPath:@"${4:keyPath}" options:${5:nil}
|
||||
@@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: log
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: NSLog(…)
|
||||
## condition: "source.objc, source.objc++"
|
||||
# --
|
||||
NSLog(@"$1"${1/[^%]*(%)?.*/(?1:, :\);)/}$2${1/[^%]*(%)?.*/(?1:\);)/}
|
||||
@@ -0,0 +1,15 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: alert
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: NSRunAlertPanel
|
||||
## condition: "source.objc, source.objc++"
|
||||
# --
|
||||
int choice = NSRunAlertPanel(@"${1:Something important!}", @"${2:Something important just happend, and now I need to ask you, do you want to continue?}", @"${3:Continue}", @"${4:Cancel}", nil);
|
||||
if(choice == NSAlertDefaultReturn) // "${3:Continue}"
|
||||
{
|
||||
$0;
|
||||
}
|
||||
else if(choice == NSAlertAlternateReturn) // "${4:Cancel}"
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: getprefs
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Read Defaults Value
|
||||
## condition: "source.objc, source.objc++"
|
||||
# --
|
||||
[[NSUserDefaults standardUserDefaults] objectForKey:${1:key}];
|
||||
@@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: obs
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Register for Notification
|
||||
## condition: "source.objc meta.scope.implementation, source.objc++ meta.scope.implementation"
|
||||
# --
|
||||
[[NSNotificationCenter defaultCenter] addObserver:${1:self} selector:@selector(${3:${2/^([A-Z]{2})?(.+?)(Notification)?$/\l$2/}}:) name:${2:NSWindowDidBecomeMainNotification} object:${4:nil}];
|
||||
@@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: setprefs
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Write Defaults Value
|
||||
## condition: "source.objc, source.objc++"
|
||||
# --
|
||||
[[NSUserDefaults standardUserDefaults] setObject:${1:object} forKey:${2:key}];
|
||||
Reference in New Issue
Block a user