icerockdev / moko-mvvm

Model-View-ViewModel architecture components for mobile (android & ios) Kotlin Multiplatform development
https://moko.icerock.dev/
Apache License 2.0
1.03k stars 95 forks source link

Use mokoMvvmFlowSwiftUI with framework #260

Open kostapostolakis opened 11 months ago

kostapostolakis commented 11 months ago

I have started a KMM project using "Regular Framework" as "iOS framework distribution". Can I use the mokoMvvmFlowSwiftUI library in this project or I should change to "Cocoapods"? Is it an easy way to implement it?

Alex009 commented 11 months ago

hi. you can have regular framework integration of KMM module and add cocoapod

pod 'mokoMvvmFlowSwiftUI', :podspec => 'https://raw.githubusercontent.com/icerockdev/moko-mvvm/release/0.16.1/mokoMvvmFlowSwiftUI.podspec'

or you can just download https://repo1.maven.org/maven2/dev/icerock/moko/mvvm-flow-swiftui/0.16.1/mvvm-flow-swiftui-0.16.1.zip and use mokoMvvmFlowSwiftUI.framework from this archive

kostapostolakis commented 11 months ago

When I import the framework, I get the following error:

Screenshot 2023-12-09 at 2 38 00 PM
kostapostolakis commented 11 months ago

Based on this issue I copy-pasted these files in my project and everything worked now. I also changed "import MultiPlatformLibrary" to "import Shared" in every file, which was the import of my shared kmm project.

joeyoggie commented 10 months ago

Based on this issue I copy-pasted these files in my project and everything worked now. I also changed "import MultiPlatformLibrary" to "import Shared" in every file, which was the import of my shared kmm project.

Hello, can you tell me where you pasted them? I tried copying them to the root of the iOS project, but it still doesn't let me import mokoMvvmFlowSwiftUI. It says 'No such module 'mokoMvvmFlowSwiftUI''

image

konstantinos-apostolakis commented 10 months ago

Based on this issue I copy-pasted these files in my project and everything worked now. I also changed "import MultiPlatformLibrary" to "import Shared" in every file, which was the import of my shared kmm project.

Hello, can you tell me where you pasted them? I tried copying them to the root of the iOS project, but it still doesn't let me import mokoMvvmFlowSwiftUI. It says 'No such module 'mokoMvvmFlowSwiftUI''

image

Try to copy paste them inside PikApp folder.

joeyoggie commented 10 months ago

Based on this issue I copy-pasted these files in my project and everything worked now. I also changed "import MultiPlatformLibrary" to "import Shared" in every file, which was the import of my shared kmm project.

Hello, can you tell me where you pasted them? I tried copying them to the root of the iOS project, but it still doesn't let me import mokoMvvmFlowSwiftUI. It says 'No such module 'mokoMvvmFlowSwiftUI'' image

Try to copy paste them inside PikApp folder.

It worked! Thank you! I copied them into Sources folder (under PikApp folder) and added them as a target in the Package.swift file.

I'm new to iOS side of things, so there may probably a more correct apprach; but hey, it works! :)