IBOutlet and IBAction private access control

223 Views Asked by At
@IBOutlet private weak var tableView: UITableView!
@IBAction private func backButton(_ sender: UIBarButtonItem){
    navigationController?.popViewController(animated: true)
}

Do you think it's right to put private on outlets and actions as above? I've never seen a coding style like this before. However, in the access controller, if you use it only in inner classes, you should use Private. I'm trying to reduce memory by using private, is this the right way to do it?

1

There are 1 best solutions below

0
Abizern On

Making a variable private does not reduce your memory footprint, just who has access to the variable.

I make my IBOutlets private because they are instantiated by the Storyboard or the nib and I'd rather not have any other parts of the app interact with them.