Skip to content

Cancel existing requests (for when a cell is multiply reused during scroll for example) #1

@Codeglee

Description

@Codeglee

Do you have any good strategies for handling this scenario?

I know that NSURLSessionDataTask has a cancel method, but I'm not sure what the best way to handle this would be.

What I've done is modified your image methods to capture the request and changed them to have NSURLSessionDataTask? as the return type.
In my calling code (the UICollectionViewCell) I capture the request and by checking the current request.state == .Running I know if I should abandon that request, nil it off and recreate it.

Do you have any better ideas?

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