I have presenter with some functions that add some UI elements on view, like this:
// Parent presenter
sview.statisticViewController
.presenter?
.setTeamStatistic(team: teamDetails)?
.thinSeperator()
.setTeamRecentMatches(matches: teamDetails.recentMatches)?
.thinSeperator()
.setTeamUpcomingMatches(matches: teamDetails.recentMatches)?
.thickSeperator()
...
// Presenter that we decorate (StatisticPresenter)
@discardableResult
func setTeamStatistic(team: TeamDetails) -> StatisticPresenter {
// Creating and setup table view with data, adding table view in stackview etc...
return self
}
@discardableResult
func thinSeperator() -> StatisticPresenter {
// Creating seperator view and adding it to stackview...
return self
}
Summary question: can I use this approach to creating views with my presenter. And if you know some cons and pros, I'll be happy to hear them.
Thank you for your ideas!
Aucun commentaire:
Enregistrer un commentaire