Collection of live templates for AppCode
- Clone this repository
- Copy Objective-C.xml file to
~/Library/Preferences/AppCode<version>/templates
- Restart AppCode.
Insert nonatomic property
@property(nonatomic) $DECLARATION$;$END$
Insert nonatomic read only property.
@property(nonatomic, readonly) $DECLARATION$;$END$
Insert nonatomic strong property.
@property(nonatomic, strong) $DECLARATION$;$END$
Insert private category code block.
@interface $CLASS_NAME$ ()
$END$
@end
Insert weakSelf statement, i.e. weak reference to self.
__weak typeof(self) weakSelf = self;
Insert strong reference to weakSelf. Useful in pair with wself template
__strong __auto_type strongSelf = weakSelf;
Insert nonatomic weak property.
@property(nonatomic, weak) $DECLARATION$;$END$
Insert nonatomic weak IBOutlet property.
@property(nonatomic, weak) IBOutlet $DECLARATION$;$END$
Add NSNotificationCenter observer
[[NSNotificationCenter defaultCenter] addObserver:$OBS$
selector:@selector($SELECTOR$)
name:$NAME$
object:$OBJ$];$END$
Dispatch after in Main queue
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)($TIME$ * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
$CODE$
});