TextExpander: Convert NSString Literal to Static Constant
Example:
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handleStuff:)
name:@"TestNotification" // Literal
object:nil];
TextExpander Code:
Content: Plain Text: static NSString * const %clipboard = @"%clipboard";
Label: NSString Constant Replace
Abbreviation: ;snss
Steps:
Delete the leading
@"
and trailing"
from the string.[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleStuff:) name:TestNotification // Remove Literal object:nil];
Copy the string to the clipboard.
Move to the position in the file where you want to insert the constant declaration.
Type
;snss
and TextExpander will insert the constant:static NSString * const TestNotification = @"TestNotification";