my code looks like this
let bgContext = NSManagedObjectContext(concurrencyType: .mainQueueConcurrencyType)
func doCoreData(progress : @escaping (Double) -> ()) {
bgContext.perform {
for i in 1...10{
let cent : Double = Double(i)/Double(10)
// do some coredata work adding and updating
progress(cent)
}
}
}
func orgnizeThings (){
doCoreData { (cent) in
DispatchQueue.main.async {
let perCent = cent * 100
SwiftSpinner.show(progress: cent, title: "loading \(perCent)")
}
}
}
calling the orgnizeThings() function will get the core data work done but I would like to to show the user how far the function is done
in this setup the SwiftSpinner view is frozen
my code looks like this
calling the orgnizeThings() function will get the core data work done but I would like to to show the user how far the function is done
in this setup the SwiftSpinner view is frozen