Multiple variables seperated with comma, in @property or synthesize statement VALID?

Discussion in 'iOS Development' started by whocaresit, Apr 22, 2009.

  1. whocaresit

    whocaresit New Member

    Joined:
    Mar 11, 2009
    Messages:
    48
    Likes Received:
    0
    Quick question,

    So, this is valid right?

    Code:
    @synthesize myLabel,button1,switchCtrl;
    
    Code:
    @property (nonatomic, retain) UILabel  *myLabel1,*myLabel2,*myLabel3; 
    
    Primary purpose is to save lot of typing for simple thing that could be done in one line.
  2. SkylarEC

    SkylarEC Super Moderator Emeritus Staff Member

    Joined:
    Sep 19, 2007
    Messages:
    6,642
    Likes Received:
    129
    I always @synthesize my properties in comma separated groups that are related somehow, but I have never tried to comma separate my property declarations. Weird.

    So, I asked around (I could have experimented, but I'm too lazy). The answer is yes you can do that.

    Thanks to kennytm (iKeyEx) for the answer.

Share This Page