pointfreeco / swift-composable-architecture

A library for building applications in a consistent and understandable way, with composition, testing, and ergonomics in mind.
https://www.pointfree.co/collections/composable-architecture
MIT License
11.91k stars 1.37k forks source link

Improve UIKit case studies: ListsOfState #3220

Closed takehilo closed 3 days ago

takehilo commented 1 week ago

I have improved the ListsOfState example. The tableView(_:cellForRowAt:) delegate method can be called multiple times for the same indexPath, and in the current code, the observe(_:) method is executed multiple times for the same indexPath. When the observe(_:) method is executed multiple times, the closure is called unnecessarily many times when the Counter model at the corresponding index is changed. To prevent this, I have added the observation cancellation logic.