0

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.

markshiz
  • 2,501
  • 22
  • 28

1 Answers1

1

Type: variable; Then you can do Extract property and get what you want.

nastasiak2512
  • 1,857
  • 14
  • 14