Hi, I'm looking at the `todoapp` example as a mode...
# mvikotlin
t
Hi, I'm looking at the
todoapp
example as a model for rebasing my app on MVIKotlin. I'd like to make my migration a little more gradual and just rewrite the root view at first (which is already a list view in my app) and have item taps launch the existing detail view `Activity`s directly like it currently does. In the
todoapp
, tapping on an item ends up in
TodoRootUi
with
TodoRootContent()
returning the Edit composable and this is all within the
compose-ui
module instead of the Android module. What's the best way to instead launch an
Activity
on Android and display a specific
ViewController
on iOS? I definitely want to migrate the rest of the UI to match the
todoapp
model but want to avoid rewriting all of the UI in one step 🙂
a
Hello! Glad you are starting to use MVIKotlin! In your case I think you can check the MVIKotlin sample (which is also a todo app) - https://github.com/arkivanov/MVIKotlin#sample-project It doesn't have anything like "root". Each screen has a "controller" entry point. The navigation is done via
Fragments
on Android and SwiftUI's
NavigationLink
on iOS. This should be easily replaceable with
Activities
and
ViewControllers
.
t
great, thank you! I'll take a look at that later
👍 1
@Arkadii Ivanov I just had a moment to skim the code
sample
code. It seems like a decent migration path would be: 1. add MVIKotlin and related dependencies to my app 2. use a structure like the
sample
app to launch my existing
Activity
classes 3. migrate my
Activity
(and
Fragment
) classes, one by one, to being thin wrappers around `Composable`s 4. once all my UI is effectively in Compose, move to a structure like the
todoapp
to cut out some of the boilerplate? Is this a path you'd recommend? Do you have other suggestions?
a
Yes, this sounds like a good way. Basically migrate activities and fragments one by one. Then optionally replace activities and fragments with a compose-aware navigation library, like Decompose.
t
great, thank you! Very excited to get there 🙂
❤️ 1
I don't have a huge number of
Activity
and
Fragment
classes but definitely enough that it'd be good to do that as a separate step. Also, multiply all of those by 2 to account for iOS 🙂