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

Table View scrolling stops when datasource is updated #19

Open
finder39 opened this issue Aug 1, 2014 · 5 comments
Open

Table View scrolling stops when datasource is updated #19

finder39 opened this issue Aug 1, 2014 · 5 comments

Comments

@finder39
Copy link
Contributor

finder39 commented Aug 1, 2014

In NewsViewController.swift function loadMore()

https://github.com/Dimillian/SwiftHN/blob/master/SwiftHN/ViewControllers/NewsViewController.swift#L72

@finder39
Copy link
Contributor Author

finder39 commented Aug 1, 2014

Tried a couple things

self.datasource = tempDatasource
self.tableView.reloadData()
self.tableView.beginUpdates()
tempDatasource.addObject(posts[0] as Post)
self.datasource = tempDatasource
self.tableView.insertRowsAtIndexPaths([NSIndexPath(forRow: self.datasource.count-1, inSection: 0)], withRowAnimation: UITableViewRowAnimation.Fade)
self.tableView.endUpdates()

tried wrapping in GCD

dispatch_async(dispatch_get_main_queue(), {
}

All to no avail :/ I am curious if the issue is that it is a UITableViewDelegate subclass and self.datasource is an NSArray instead of setting it to an NSMutableArray that can be updated and calling reloadData()

@Dimillian
Copy link
Owner

I know exactly what it is. This is the cache write which is not multi threaded. I tried to dispatch it but for some reason I'm getting an unknown error with Swift. I'll wait for beta 5.

https://github.com/Dimillian/HackerSwifter/blob/master/Hacker%20Swifter/Hacker%20Swifter/HTTP/Cache.swift#L126

This call should be put on a background queue.

Well, it's also the model HTML scrapping, I'll dispatch all that in a later version. No more scroll stop :)

@finder39
Copy link
Contributor Author

finder39 commented Aug 3, 2014

Ya, that is definitely a strange error while trying the following there

   public override func setObject(object: AnyObject, key: String) {
        dispatch_async(dispatch_get_global_queue(self.priority, UInt(0)), {
            NSKeyedArchiver.archiveRootObject(object, toFile: self.fullPath(key))
        })
    }

@finder39
Copy link
Contributor Author

finder39 commented Aug 3, 2014

I have made is successfully compile and work with tests in Dimillian/HackerSwifter#12

It doesn't seem to fix the scroll stop, I will keep looking into it.

@Rokimkar
Copy link

Rokimkar commented Jul 9, 2016

Is this bug still there or its been fixed??

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

3 participants