Home > Net >  Property is accessed but result is unused
Property is accessed but result is unused

Time:02-08

I saw there another similar one to my question but that was very old! , So I have an UIActivityIndicatorView but when i try to call the .hidesWhenStopped it just warns Property is accessed but result is unused for no reason?

What could be the problem? I tried under viewDidLoad too but same :(

This is a part of my code:

Timer.scheduledTimer(withTimeInterval: 3, repeats: false) { [self] _ in
   monitorimiTableView.reloadData()
   configureTableView()
   loaderMonitorimi.hidesWhenStopped // Property is accessed but result is unused
}

CodePudding user response:

You need to assign a value to the property:

loaderMonitorimi.hidesWhenStopped = true

(or false if you don't want to hide it)

If you just write loaderMonitorimi.hidesWhenStopped without any assignment, this expression will result in the boolean value stored in the hidesWhenStopped property, but the result of the expression is not used, hence the warning.

  •  Tags:  
  • Related