Search code examples
iosswiftswiftuiweb-component

How can WebComponents be integrated in an IOS App?


I need to create an UI-Component Library that should be integratable and work anywhere and everywhere.

I found that WebComponents can work in any Browser and all SPA-Frameworks like Vue, Angular and React. I also found a way to use a Web-component in Android using Webview from here: https://dukescript.com/best/practices/2017/06/11/AndroidStudio.html Meaning I could at least provide an Android Developer with a guide to integrate the Webcomponent, or I can make simple Library for Android to wrap the Webcomponent with the Webview, so that the Android Developer can have that "plug & play" experience.

But I struggle to find a way in IOS.

So is it possible to use a Web-component in an IOS app, and if so how?


Solution

  • The approach for Android and iOS are similar in this regard. They both provide a view that can display web based content and can be positioned anywhere in a hierarchy of native views. The code you use to wrap the web view will be different, and the classes you use from the SDKs will be different, but the overall approach would be the same.

    On iOS you would probably use a WKWebView.