I'm not very much old with DispatchQueue
things (including DispatchGroups, Qos etc.). And I have a concern right now.
It's like, I have a ViewController that is reused for Android's ViewPager UI. And in that VC, I have a TableView which reloads every time the "page" in the ViewPager is changed.
I have a favourite button
property in the TableView cell. When user tap on that button, it stores required information for a post call (JSON).
I want to make the post call whenever viewWillDisappear
runs. And there I want to create background threads for each "page" and catch the already created thread in case a user hits a "page" for which the post call could not culminate for any reasons.
Here is what I have in my class:
var workItem1: DispatchWorkItem!
var dispatch1: DispatchQueue!
and
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
}
What should I do to achieve my goal?