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

37 Views Asked by At

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.

0

There are 0 best solutions below