-
Notifications
You must be signed in to change notification settings - Fork 28
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
The flow is not converted to property even after using @NativeCoroutinesState #14
Comments
Example of it's use here in case it helps
https://github.com/joreilly/Confetti/blob/main/iosApp/iosApp/ContentView.swift
Are you using @StateViewModel?
…On Mon 23 Jan 2023, 13:11 Bibuti Koley, ***@***.***> wrote:
The library is not generating the correct @Property
<https://github.com/Property> for the defined StateFlow.
[image: image]
<https://user-images.githubusercontent.com/20051993/214047814-d50c0b60-238e-4ea3-a0f8-a4e4524a6dee.png>
[image: image]
<https://user-images.githubusercontent.com/20051993/214047942-1e21b725-3ff8-4b66-b856-367fc7efcade.png>
Is there a script or command that needs to be executed for the correct
code to be generated?
—
Reply to this email directly, view it on GitHub
<#14>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAABRHRTAPYBMOKKY4GFRZTWTZ7R3ANCNFSM6AAAAAAUD2L73I>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
@joreilly Yes.. I referred the Confetti Repository. |
Hi @bibutikoley! The properties generated by KMP-NativeCoroutines are extensions properties. |
Hello @rickclephas, I'm not able to access the randomNumbers property. It gives me an error. Here is my build.gradle.kts file (shared module)
|
@joreilly @rickclephas Thank You for the support and Sorry for the confusion. I placed the But would like to know if inheritance is supported or not? |
Interesting error message. Anyway I think it's because print("ViewModel -> \(self.viewModel.randomNumbers)") |
What exactly do you mean by "inheritance"? |
@rickclephas By Inheritance I mean, BaseViewModel : KMMViewModel() and RandomViewModel : BaseViewModel() Is this possible? |
Yeah that should be possible as well. |
@rickclephas Thanks for the help.. closing this issue. |
@rickclephas Can we use SharedFlow with this Library? Something like this for one-time events |
No, Could you share some more information about this use case? |
@rickclephas I want to perform navigation in the app. (i.e. - One time event). This repo is simply fetching the data from newsapi and displaying it in the list view and tap of the item user navigates to details page. I'm using NativeCoroutines and KMM-ViewModel for the same. For android it works as expected but unable to achieve it in iOS. Also, the library does not generate the extension properties if ViewModel is in a different Module. |
Thanks for the sample code!
KMP-NativeCoroutines only generates the required Kotlin code. |
@rickclephas Thanks for looking into the code. The above architecture is referred from this link - Demo - https://github.com/fededri/kmm-demo I'm trying to mix the KMM-ViewModel, NativeCoroutines and The Architecture above to move business logic and ui-states of the app to shared module and the UI(android and iOS) will receive the ui-states directly from the viewmodel and perform respective events. I would request you to please take a look at the above links and share your feedback. Also, when working with generics in KMM-ViewModel do we need to cast the value to access it in swift code or is there any other solution available? ref.https://github.com/rickclephas/KMM-ViewModel/issues/15 |
@rickclephas Is there a way to directly initialize the Currently we are passing the value from with init(viewModel: ObservableViewModel.Projection) Please let me know your thoughts on this |
You can use the same approach and pass the init(viewModel: NewsListingViewModel) {
self._newsListingViewModel = ObservedViewModel(wrappedValue: viewModel)
} |
Hi @rickclephas, I tried using the code snippet that you have shared. But unfortunately with this approach the Flow in the viewModel(annotated with NativeCoroutinesState) is not receiving any items emitted by the ViewModel.
In the above eg. |
You are only processing a single event during the initialisation of the view. Only the |
The library is not generating the correct @Property for the defined StateFlow.
Is there a script or command that needs to be executed for the correct code to be generated?
The text was updated successfully, but these errors were encountered: