Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
turk-jk opened this issue Aug 13, 2018 · 1 comment
Open

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

turk-jk opened this issue Aug 13, 2018 · 1 comment

Comments

@turk-jk
Copy link

turk-jk commented Aug 13, 2018

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

@andreamazz
Copy link
Collaborator

Hey @turk-jk
Did you try to print the percentage? Check if it prints the intermediate values, and at which speed. Sometimes the percentage in this kind of stuff is iffy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants