[REFACTOR] Convert all ListDiffable models to be Immutable

Open
#405 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
30/100
Issue type
Refactor
Clarity
Needs clarification
Activity status
Stale
Tech stack
swift
Domain
mobile

Research direction

Read the Immutability section of Guides/Getting Started.md, then search the repository for ListDiffable conformances and inspect the associated model declarations. Done means every relevant ListDiffable model uses immutable fields and the affected models no longer rely on in-place edits.

Written by the indexing model from the issue text.

Description

Priority: Low

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
}
Dominant language
Swift
Stars
15
Forks
2
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from cuappdev/pollo-ios

All issues in cuappdev/pollo-ios

Similar issues

More Swift issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.