cuappdev / cuappdev/pollo-ios

[REFACTOR] Convert all ListDiffable models to be Immutable

Open
#405 0 comments 0 reactions 0 assignees View on GitHub
Priority: Low
Dominant language
Swift
Stars
15
Forks
2
PR merge metrics
No merged PRs in 30d

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
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.