NyanNyan
NyanNyan

Reputation: 49

Working properly with snapshot struct in DataSource when Insert\Delete\Update states

What is the proper way to use snapshots in dataSource when u want to insert\update\delete cells ?

For example, first way

func test() {
    var snapshot = dataSource.snapshot
    snapshot.insert\delete\append
    dataSource.apply(snapshot)
}

Second way

final class Test {
    var snapshot = Snapshot()

    func test() {
        snapshot.insert\delete\append
        dataSource.apply(snapshot)  
    }
}

The last - I have isolated snapshot struct which is not coupled with dataSource. I have tested both but dont see difference between these ways.

Upvotes: 0

Views: 55

Answers (0)

Related Questions