Hi
Here is a little xCode addition for auto text macros for onEnter, onExit, onEnterTransitionDidFinish and simplified init methods. Just copy/paste the code in some text editor, save it as "ObjectiveC.xctxtmacro" and put it in "~/Library/Application Support/Developer/Shared/Xcode/Specifications" directory (reminder: ~ means your "users" directory).
Completion Prefixes:
init - simplified Init block
onen - onEnter block
onent - onEnterTransitionDidFinish block
onex - onExit block
So from now on just type e.g. "onen" and hit Ctrl + "." and xCode will insert your onEnter block. If you prefer original xCode init block and not this one, just delete the text under "// Custom Init Definition" from the code below...
Code:
/**
Objective C custom text macro specifications
http://www.4iphone4.me
*/
(
//
// Objective-C custom language macros (they also show up for Objective-C++)
// Custom Init Definition
{
Identifier = objc.init;
BasedOn = objc;
IsMenuItem = YES;
Name = "init Definition";
TextString =
"-(id)$(PreMethodDeclSpacing)init {
self = [super init];
if (self == nil) return nil;
<#!initializations!#>
return self;
}
";
CompletionPrefix = init;
IncludeContexts = ( "xcode.lang.objc.implementation" );
ExcludeContexts = ( "xcode.lang.objc.block" );
},
// Custom onEnter Definition
{
Identifier = objc.onen;
BasedOn = objc;
IsMenuItem = NO;
Name = "onEnter Definition";
TextString =
"-(void) onEnter {
<#!initializations!#>
[super onEnter];
}
";
CompletionPrefix = onen;
IncludeContexts = ( "xcode.lang.objc.implementation" );
ExcludeContexts = ( "xcode.lang.objc.block" );
},
// Custom onExit Definition
{
Identifier = objc.onex;
BasedOn = objc;
IsMenuItem = NO;
Name = "onExit Definition";
TextString =
"-(void) onExit {
<#!initializations!#>
[super onExit];
}
";
CompletionPrefix = onex;
IncludeContexts = ( "xcode.lang.objc.implementation" );
ExcludeContexts = ( "xcode.lang.objc.block" );
},
// Custom onEnterTransitionDidFinish Definition
{
Identifier = objc.onent;
BasedOn = objc;
IsMenuItem = NO;
Name = "onEnterTransition Definition";
TextString =
"-(void) onEnterTransitionDidFinish {
<#!initializations!#>
[super onEnterTransitionDidFinish];
}
";
CompletionPrefix = onent;
IncludeContexts = ( "xcode.lang.objc.implementation" );
ExcludeContexts = ( "xcode.lang.objc.block" );
},
)