Using Swift4.1, iOS11.3.1 and Xcode 9.3,
I have a conflict going on between tableView.scrollToRow(at:
and the tableView-delegate method cellForRowAt indexPath:
The procedure is as follows:
- network-fetch of data1
- call tableView.reloadData() (..filling a tableView with this data1)
- scroll to a defined cell (...so far so good everything works and data1 shows..) But then if I add...
- during all of the above - I do a background-fetch of additional data2
- when fetched, calling tableView.reloadData() again (filling the the additional data2 as well in the same tableView)
Now - it seems that the additional-data2 fetch is coming in right at the moment where the scroll is carried out. In this case, the scrolling interferes with the cellForRowAt of the additionally fetched data. This leads to cell-order that is completely corrupt !!
The needed solution:
How can I detect the data1-scroll's ending moment (in order to hold back the background-fetch's reloadData()) until the scrolling is done ??
Any help on this appreciated.