Reputation: 2561
Is there a way to assign a method parameter to a property using a keyboard command? I try to use "Extract Field" in this case, but the IDE errors out. A common use case is assigning properties out of an object's constructor.
-(id)initWithVariable:(NSNumber*)variable {
self = [super init];
if ( self ) {
// Need a way to do this with a keyboard command:
self.variable = variable
}
return self;
}
Right now, the best way I can find to do this is to physically type out self.variable = variable
and then do a [Alt] + [Enter] to add the property that way, but it would nice to not have to type this rote information out into the IDE each time.
Upvotes: 0
Views: 48
Reputation: 1937
Type:
variable;
Then you can do Extract property and get what you want.
Upvotes: 1