Skip to content
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

Addition of Compose Multiplatform example project #115

Closed
neelratanguria opened this issue Feb 16, 2024 · 4 comments
Closed

Addition of Compose Multiplatform example project #115

neelratanguria opened this issue Feb 16, 2024 · 4 comments

Comments

@neelratanguria
Copy link
Contributor

It would be really helpful if this repository provided an example of Compose Multiplatfrom project as well. FYI, I managed to get the CMP project running fine, but it costed me more than 4hrs. I would love to contribute the boilerplate this repo.

Quick note: I was really confused when initializing the BlueFalcon object on iOS side, because the way it was inject directly into the ViewModel in KMP project. Then, I realised that ContextApplication can be garbage for initializing the iOS implementation. Here is how it looks like

AppModule.ios.kt

actual class AppModule {
    actual val blueFalcon: BlueFalcon
        get() = BlueFalcon(ApplicationContext(), null)
}

AppModule.android.kt

actual class AppModule(
    private val context: Context
) {
    actual val blueFalcon: BlueFalcon
        get() = BlueFalcon(context as ApplicationContext, null)
}
@Reedyuk
Copy link
Owner

Reedyuk commented Feb 16, 2024

Hi @neelratanguria - i dont have the time to do a compose multiplatform example but welcome any pr's that introduce one.
As for the context, its probably not very clear in the docs. You can pass null, nsbundle or even UIApplication.

@neelratanguria
Copy link
Contributor Author

I will do it then i guess

@neelratanguria
Copy link
Contributor Author

Hi @Reedyuk,
I have created a pull request for the discussed example. Please do review it.

@Reedyuk
Copy link
Owner

Reedyuk commented Feb 18, 2024

Many thanks for your change, i have merged in.

@Reedyuk Reedyuk closed this as completed Feb 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants