Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save technomorph/78c8c645714f78e98fa8fca02401483d to your computer and use it in GitHub Desktop.
Save technomorph/78c8c645714f78e98fa8fca02401483d to your computer and use it in GitHub Desktop.
Use Reg-Ex Search and Replace to help create @synthesize out of your already typed Interface @Property
In XCode always finding it hassle to continuouly enter @synthesize for @properties already entered.
I Came Up with a RegEx to help me.
I copy the properties from the .h page and paste them in the .m
IE:
#pragma mark TAGS2 INFO HELP
@property (nonatomic) NSString* tags2Help;
@property (nonatomic) IBOutlet NSTextField* tags2HelpTF;
#pragma mark TAG2 FINAL PREVIEW AND APPLY
@property (nonatomic) NSString* selPreview2;
@property (nonatomic) IBOutlet NSTextField* selPreview2TF;
@property (nonatomic) IBOutlet NSButton* addSelPreview2;
@property (nonatomic) BOOL canAddPreview2;
#pragma mark LOGGING
@property (nonatomic) IBInspectable BOOL logCalls;
@property (nonatomic) IBInspectable BOOL logLoad;
@property (nonatomic) IBInspectable BOOL logBindings;
@property (nonatomic) IBInspectable BOOL logTags1;
@property (nonatomic) IBInspectable BOOL logTags2;
@property (nonatomic) IBInspectable BOOL logChanges;
Then do a RegEx Find an Replace with
FIND:
@property \(nonatomic\) (IBOutlet |IBInspectable )?.*?\s
REPLACE:
@synthesize
^^^ NOTE THERE IS A SPACE AT THE END OF @synthesize
the results turn into this:
#pragma mark TAGS2 INFO HELP
@synthesize tags2Help;
@synthesize tags2HelpTF;
#pragma mark TAG2 FINAL PREVIEW AND APPLY
@synthesize selPreview2;
@synthesize selPreview2TF;
@synthesize addSelPreview2;
@synthesize canAddPreview2;
#pragma mark LOGGING
@synthesize logCalls;
@synthesize logLoad;
@synthesize logBindings;
@synthesize logTags1;
@synthesize logTags2;
@synthesize logChanges;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment