DispatchGroup notify before all leave called

I have an iOS application that runs multiple classes(every class in a separate thread) and I want to get a notification when all the class finishes their run. So I have a BaseClass: class BaseClass { var completeState: CompleteState init(completeState: CompleteState) { self.completeState = completeState self.completeState.dispatch.enter() } func start() { } } And this is… Read More DispatchGroup notify before all leave called

How to set a variable that runs on background thread and needs to access ui

I am fetching a data source in background. There are 2 urls and I choose it with a tabBar. To know which url I need to access, I use navigationController?.tabBarItem.tag. But It throws an error of "navigationController must be used from main thread only". I’ve tried to wrap it with DispatchQueue.main.async but it didn’t work.… Read More How to set a variable that runs on background thread and needs to access ui