New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using MVP #35
Comments
Attach presenter in |
So I am using Mosby(probably should have stated that in the initial comment) and my presenter is shown below.
How would I go about making this usable within a controller? Or should I wait until @sockeqwe has added offical "support" to Mosby? |
I don't know much about Mosby, but shouldn't you be interacting with the view via an interface? In that case, have the |
For Mosby you need to write your own |
Official Mosby support is around the corner (works as described by Kirill Kirill Boyarshinov notifications@github.com schrieb am Mi., 27. Apr.
|
Here is the official Mosby plugin for conductor: |
The Mosby + Conductor is best. |
Shouldn't this issue be closed then?.. |
I agree, this should be closed. It's also trivial to implement this yourself. class SomeController : Controller() {
private val presenter = SomePresenter()
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup)
= inflater.inflate(R.layout.something, container, false)
override fun onAttach(view: View) {
presenter.takeView(view as SomePresenter.View)
}
override fun onDetach(view: View) {
presenter.dropView()
}
}
class SomePresenter {
fun takeView(view: View) {
// Do whatever with view.
}
fun dropView() {
// Clear whatever was using the view.
}
interface View {
fun doSomething()
}
} |
Is mosby-conductor supported with Conductor 2.0? @sockeqwe doesn't respond to issues |
Sorry, I have accidentally unwatched my own repository and didn't get notifications about Conductor 2.0 issues. Right now mosby-conductor doesn't work with Conductor 2.0 because of imho a bug in Conductor 2.0, see #85 and sockeqwe/mosby-conductor#2 |
It sounds like people are pretty satisfied with Mosby's support and/or rolling their own solution, so I'll close this. Feel free to re-open if anything new emerges. |
Another small MVP library - https://github.com/bangarharshit/ConductorMVP. You are encouraged to read the code (it is just 2 class) and modify it based on your need. |
I am wanting to switch from Flow to Conductor, but I cannot seem to grasp my head around when to create my presenter in the controller. After looking at the source, I would imagine that creating the presenter in preAttach then attaching the view to the presenter and detaching the view in postDetach would be a good route to go, but I am struggling on actually doing that. Any help/advice would be greatly appreciated!
(If this isn't the right place for this, let me know and I'll remove it)
The text was updated successfully, but these errors were encountered: