0

I just started to work on a new project. It has a lot of legacy code and I found the following code

@interface WLLeftSideViewController : UIViewController {

@private
    __weak IBOutlet UIButton *_signInButton;
    __weak IBOutlet UIButton *_signOutButton;
    __weak IBOutlet UILabel *_nameLabel;
    __weak IBOutlet UILabel *_emailLabel;
    __weak IBOutlet WLLeftSideMenuView *_tableView;
    __weak IBOutlet UIButton *_settingsButton;

    __weak IBOutlet NSLayoutConstraint *_heightConstraint;
}

I have a couple of doubts:

  • What could be the advantage of using private ivars for an IBOutlet?
  • Why add the __weak? As I understand in ARC environment ivars are always weak.

Thanks

drasick
  • 280
  • 4
  • 14

1 Answers1

3

The key word here is legacy

  • No advantages
  • All variables (ivars and not) by default is strong.
Cy-4AH
  • 4,370
  • 2
  • 15
  • 22