-
Notifications
You must be signed in to change notification settings - Fork 2
Description
https://github.com/Instagram/IGListKit/blob/master/Guides/Getting%20Started.md
(Read Immutability section)
IGListKit is built w/ the core foundation assuming that all models used are immutable. The reason for this is that immutability allows for correct diffing between updates and IGListKit's quick diffing algorithm is one of its main benefits.
Currently, a lot of our models mutable (i.e. if we want to edit a field of a model, we just directly edit that field instead of creating a new instance of that model). This leads to a lot of bugs where we call performUpdates and views don't get updated properly. The best solution to this is to make all of our models immutable by declaring all fields as let instead of var. This should also prevent the increase of mysterious // hard to debug issues in the future.
ex)
class Poll {
let name: String
let text: String
}