Skip to content

not responding when using inside NSManagedObjectContext.perform{} #126

Description

@turk-jk

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions