-
I have a mediaSessionService and a mediaController that I'm trying to open and manage on the Android side. If I do things directly in Kotlin, I can get everything working, but the function to manage the mediaController is @composable and can only be called from a @composable context. The easiest way I've found so far is to go into one of the generated Kotlin files (for example
I would like the mediaController to be a part of the AudioManager class, but again, the function I'm using to create and manage it is only available through an @composable function. Does anyone know of a way to do this within Xcode/Swift/Skip, or am I better off just editing after the fact? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
For reference, here is the Kotlin file for the mediaController. The @composable function is called I think the other issue is that the way I've gotten this to work relies on the |
Beta Was this translation helpful? Give feedback.
-
I recommend starting with the docs on Compose Integration, and taking a look at various examples of how we do this.
Definitely don't do that, since your changes will be overwritten the next time you transpile the original Swift. You can use Skip Comments for simple modifications of the Kotlin output, or for more advanced usage, add a raw Kotlin file to your Skip/ folder and reference the types in that from your Swift code. You might also want to consider building on top of our existing SkipAV framework, in case that is sufficient for your needs. |
Beta Was this translation helpful? Give feedback.
-
Note that generally you can replace "by remember..." with "= remember..." and then unwrap with ".value". So for example: |
Beta Was this translation helpful? Give feedback.
I recommend starting with the docs on Compose Integration, and taking a look at various examples of how we do this.
Definitely don't do that, since your changes will be overwritten the next time you transpile the original Swift. You can use Skip Comments for simple modifications of the Kotlin output, or for more advanced usage, add a raw Kotlin file to your Skip/ folder and reference the types in that from your Swift code.
You might also want to consider building on top of our existing SkipAV framework, in case that is sufficient for your needs.