Closed edgarss closed 4 years ago
without configure()
how can you setup the view layout ?
because view should not decide itself to setupViews in viewDidLoad()
, presenter should be the one who tell view to setupViews by configure()
function 🤔
without
configure()
how can you setup the view layout ?because view should not decide itself to setupViews in
viewDidLoad()
, presenter should be the one who tell view to setupViews byconfigure()
function 🤔
I just think it will better for put a function for setup views (init views) before call output?.viewDidLoad
. Like this example:
override func viewDidLoad() {
super.viewDidLoad()
setUpViews()
output?.viewDidLoad()
}
@Dekablade01 What do you think?
@Dekablade01 "The Presenter is a PONSO that mainly consists of logic to drive the UI. It knows when to present the user interface. It gathers input from user interactions so it can update the UI and send requests to an Interactor." - Presenter. So maybe Presenter doesn't need to take care of configure for the view controller.
without
configure()
how can you setup the view layout ? because view should not decide itself to setupViews inviewDidLoad()
, presenter should be the one who tell view to setupViews byconfigure()
function 🤔I just think it will better for put a function for setup views (init views) before call
output?.viewDidLoad
. Like this example:override func viewDidLoad() { super.viewDidLoad() setUpViews() output?.viewDidLoad() }
@Dekablade01 What do you think?
What I think is,
VIPER's submodules is also be configured in presenter.viewDidLoad()
which submodule is kind of subview
.
As you mention above Presenter knows when to present the user interface
. so presenter should be the one who decide when to setup view including when to setup submodule.
And you won't miss calling setupView()
in view did load because configure()
is prepared for implementation. Also what if some one don't create a setupView()
function and just code directly in viewDidLoad()
.
then later we will argue about this
func viewDidLoad() {
super.viewDidLoad()
output?.viewDidLoad()
configureNavigationBar()
customView.backgroundColor = .green
customView.alpha = 0.5
view.addSubview(customView)
stackView.snp.makeConstraints { $0.edges.equalToSuperView() }
}
// or
func viewDidLoad() {
super.viewDidLoad()
output?.viewDidLoad()
}
func configure() {
configureNavigationBar()
customView.backgroundColor = .green
customView.alpha = 0.5
view.addSubview(customView)
stackView.snp.makeConstraints { $0.edges.equalToSuperView() }
}
@Dekablade01 👍Greate! @edgarss @jasonnam How about you guys? For the submodule case, Presenter will be the one who decides to configure the view of submodule. Then maybe keep this follow for setup view?
About this pull request, so based on the project then I think we just keep this branch, don't need to merge this into master.
removed unnecessary whitespaces removed configure() in viewInput