https://kotlinlang.org logo
Title
t

Travis Reitter

06/12/2022, 3:07 PM
hi, can anyone recommend code samples for MVIKotlin on iOS with traditional
UIView
-based `ViewController`s? I'd like to migrate to MVIKotlin before migrating to SwiftUI
a

Arkadii Ivanov

06/12/2022, 10:32 PM
I have not seen any examples yet, but that should be quite similar to the Android example - https://github.com/arkivanov/MVIKotlin/tree/master/sample/coroutines/app-android/src/main/java/com/arkivanov/mvikotlin/sample/coroutines/app/main The shared code structure should be similar. In iOS, just instantiate your shared entry points (a ViewModel or a Controller, etc.) in a
ViewController
, and implement the view interface using
BaseMviView
class. Use
LifecycleRegistry
to manually controll the lifecycle from
ViewController
callabacks. This should work I guess.
t

Travis Reitter

06/13/2022, 3:49 AM
great, thanks! I'll try that out
@Arkadii Ivanov I'm checking out this sample and trying to work out the source for
LifecycleRegistryKt
in
LifecycleWrapper
, mainly this line:
let lifecycle = LifecycleRegistryKt.LifecycleRegistry()
Do you know how this is sourced? It seems to be implicitly pulled in through
essenty
which
TodoLib
pulls in via its
build.gradle.kts
. But when I do the same in my app, I still can't resolve
LifecycleRegistryKt
and don't see anything relevant in my shared library's generated header file (the equivalent of
TodoLib.h
)
t

Travis Reitter

06/16/2022, 4:08 PM
ah, thanks! I do that for other deps but forgot about it
👍 1
@Arkadii Ivanov I was going to ask about an issue I just hit with the iOS example in MVIKotlin having unimplemented coroutines dispatchers but it seems you recently addressed that 🙂
an issue I just hit after the update though is, when I try to open the
todo-app-ios
project file in Xcode, I get:
Project MVIKotlin/sample/todo-app-ios/todo-app-ios.xcodeproj cannot be opened because it is missing its project.pbxproj file.
a

Arkadii Ivanov

06/17/2022, 4:20 PM
I believe it worked for me, but thanks for raising! Could you please file an issue on GitHub?
t

Travis Reitter

06/17/2022, 5:05 PM
I think I figured out what's going on but there's some simple clean-up to do: https://github.com/arkivanov/MVIKotlin/issues/42
👍 1