0

My code:

...
self.tableView.reloadData()
self.someOldValue = self.someNewValue
...

TableView delegate and datasource methods work with self.someOldValue. I need use self.someOldValue in those methods before it changes. How to do it? Method reloadData() works asynchronous and tableView delegate and datasource methods works with newValue already(self.someOldValue = self.someNewValue executes before self.tableView.reloadData())

Dávid Pásztor
  • 51,403
  • 9
  • 85
  • 116
pragmus
  • 3,513
  • 3
  • 24
  • 46
  • Why don't you make the data source methods work with the old value instead? – Dávid Pásztor Aug 11 '17 at 14:41
  • 1
    put the second line inside the aync method's done callback. so you will be sure that line will be executed after `tableView.reloadData()` completed. – Okan Kocyigit Aug 11 '17 at 14:46
  • Take a look at the answers to this post: https://stackoverflow.com/questions/16071503/how-to-tell-when-uitableview-has-completed-reloaddata – DonMag Aug 11 '17 at 17:35

0 Answers0