marcosgriselli / ViewAnimator

ViewAnimator brings your UI to life with just one line

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No animation for Header and Footer of UICollectionView or UITableView

dillidon opened this issue · comments

commented

Thats all)

commented

One more thing - views (headers, cells and footers) should be sorted... just caught it in my project...

After looking into this issue I believe each app should manage their own selection of views that need to be animated. I can't remember if this issue was created before we implemented the animate(views: ... API. It's not that complicated and we can even add a function that grabs all cells and headers in the docs. This is the result of animating headers and footers:

header_footer_animations

And here's a quick example of how views can be picked for animations:

private func viewsToAnimate(in tableView: UITableView) -> [UIView] {
    var views = [UIView]()
    tableView.tableHeaderView.flatMap { views.append($0) }
    tableView.headerView(forSection: 0).flatMap { views.append($0) }
    views.append(contentsOf: tableView.visibleCells)
    tableView.footerView(forSection: 0).flatMap { views.append($0) }
    tableView.tableFooterView.flatMap { views.append($0) }
    return views
}

I know this is super late but I hope this helps someone trying to achieve this result.