You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
extensionRefreshablewhere Self:UIViewController{/// Install the refresh control on the table viewfunc installRefreshControl(){letrefreshControl=UIRefreshControl()
refreshControl.tintColor =.primaryColor
refreshControl.addTarget(self, action: #selector(handleRefresh(_:)), for:.valueChanged)self.refreshControl = refreshControl
if #available(iOS 10.0,*){
tableView.refreshControl = refreshControl
}else{
tableView.backgroundView = refreshControl
}}}
Protocol extension is cool but somehow I'm not a fan of it. I always consider composition first, to extract the specific task to one entity that does that well. It looks like this
The other day I was doing refresh control, and I saw this Swift Protocols with Default Implementations as UI Mixins
Protocol extension is cool but somehow I'm not a fan of it. I always consider composition first, to extract the specific task to one entity that does that well. It looks like this
It is a bit
Rx
, we can use block if we like, but the idea is we can declare thisRefreshHandler
and use it everywhere we wantThe text was updated successfully, but these errors were encountered: