KevinnZou/compose-webview-multiplatform

Question: loadHtmlData with .css in local asset

Closed this issue · 1 comments

Hello Zou,
Thank you for your fantastic work on the WebView for KMP. Recently, I encountered a use case where I need to create HTML data dynamically, while keeping the associated .css files in the local asset folder.

It looks I can do this in Android:
val webViewState = rememberWebViewStateWithHTMLData(html2, baseUrl ="file:///android_asset/"))

But the above code doesn't work for iOS. Would you please let me know how to do it in iOS?

Thanks
gerandleaf

NVM, I figured it out from your source code :)

val res = NSBundle.mainBundle.resourcePath + "/compose-resources/assets/"
val url = NSURL.fileURLWithPath(res)