ra1028 / Carbon

🚴 A declarative library for building component-based user interfaces in UITableView and UICollectionView.

Home Page:https://ra1028.github.io/Carbon

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Initializing `Renderer` without passing the target instance.

ra1028 opened this issue · comments

Checklist

Description

Allow Renderer to be initialized without passing the target instance.

Motivation and Context

Become no need to add lazy to renderer property declarations.
Also, the timing when delegate and dataSource are set in tableView becomes explicit.
Depending on when delegate and dataSource are set, cases have been found where unnecessary space is available above or below the tableView.

Proposed Solution

@IBOutlet weak var tableView: UITableView!

let renderer = Renderer(
    adapter: UITableViewAdapter(),
    updater: UITableViewUpdater()
)

func viewDidLoad() {
    super.viewDidLoad()
    renderer.target = tableView
}