Skip to content

How to write an @Composable function in Swift #364

Answered by marcprux
jwcounts asked this question in Q&A
Discussion options

You must be logged in to vote

I recommend starting with the docs on Compose Integration, and taking a look at various examples of how we do this.

The easiest way I've found so far is to go into one of the generated Kotlin files (for example ContentView.kt) and directly insert the data there.

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.

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@jwcounts
Comment options

@marcprux
Comment options

Answer selected by marcprux
Comment options

You must be logged in to vote
1 reply
@jwcounts
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants