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
  • 40,247
  • 8
  • 59
  • 80
pragmus
  • 2,635
  • 2
  • 19
  • 45
  • 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