I have a class with init function, which contains URLSession.shared.dataTask(with URL)
It gets some data, modifies it and I want it to be listed in TableView.
In TableView extension of ViewController class file when I am referring to my data object properties, these are all empty, because all code in the closure is running after TableView setup and functions (ex: numberOfRowsInSection).
I tried using DispatchQueue.main.async
function but same effect.
Asked
Active
Viewed 21 times
0

Eren ÇELİK
- 102
- 1
- 8

Simon Walachowski
- 131
- 1
- 1
- 9
-
After getting data, reload your tableView. `tableView.reloadData()` – dahiya_boy Jan 14 '19 at 13:26
-
How can I refer to `tableView` from data object? – Simon Walachowski Jan 14 '19 at 13:32