ra1028/Carbon

[Idea] Make `alwaysRenderVisibleComponents` true by default

ra1028 opened this issue · 0 comments

Checklist

Description

Make alwaysRenderVisibleComponents true by default in UITableViewUpdater and UICollectionViewUpdater.
And make Component not required to implement shouldComponentUpdate.
Even if it returns false by default, it can be rendered always in the updater.

Expected changes

  • alwaysRenderVisibleComponents set true by default.
  • shouldComponentUpdate returns false by default.
  • Abolish skipReloadComponents.

e.g.

struct Label: Component {
    var text: String

    func renderContent() -> UILabel {
        return UILabel()
    }

    func render(in content: UILabel) {
        content.text = text
    }

- // always return `false`, and updater reloads visible items after updates.
-    func shouldContentUpdate(with next: Label) -> Bool {
-        return text != next.text
-    }
}

Motivation and Context

It eliminates the need for developers to implement shouldContentUpdate.
Because it is the most iterative implementation in app using Carbon, omitting it will increase development efficiency and safety.

Discussion

Agree👍 or disagree👎