DianQK / Flix

iOS reusable form library in Swift.
MIT License
726 stars 43 forks source link

Add in Demo/Guide in main README showcasing how to dynamically add in new CellProvider #20

Closed 10000TB closed 6 years ago

10000TB commented 6 years ago

Often times in real app, there are async requests return after viewDidLoad, and we want to update UI upon that return. In this particular context of Flix, main README does not document how to dynamically add in new cellProvider, but it seems there are ways to achieve that with Flix. So it would be nice to add a new section for that.

@DianQK Wdyt ?

DianQK commented 6 years ago

Just call build, but you can hide this provider's values.

10000TB commented 6 years ago

build works.

But I notice that when I am call build second time, there is a short period of view freezing (in a sense where you cannot scroll, and re-build process also brings in some unwanted animation

DianQK commented 6 years ago

try this code:

tableView.flix.animatable.build(providers).decideViewTransition = { changesetInfos in
    // ...
    return ViewTransition.reload
}
10000TB commented 6 years ago

Huge thanks @DianQK !