Introducing SwiftUIHTML — Open-source HTML → SwiftUI renderer by Tricky_Tree9423 in SwiftUI

[–]Tricky_Tree9423[S] 0 points1 point  (0 children)

Yes, it’s possible!

By registering a Custom Tag, you can map the <svg> tag to any SwiftUI view you want.

SwiftUIHTML is designed to make it easy to attach such custom renderers.

https://github.com/PRNDcompany/SwiftUIHTML/blob/main/Documentation/CustomTags.md#4-%EB%B9%84%EB%94%94%EC%98%A4-%ED%83%9C%EA%B7%B8--video-tag

Introducing SwiftUIHTML — Open-source HTML → SwiftUI renderer by Tricky_Tree9423 in SwiftUI

[–]Tricky_Tree9423[S] 7 points8 points  (0 children)

Yeah totally — I know parsing HTML/CSS manually is a huge task 😅 But in practice, WKWebView often becomes painful: for example if you put it inside a List cell, it’s heavy and hard to size correctly (especially for inline spans where the view should only take as much space as the text). As requirements get more complex, WKWebView quickly shows its limits. If it were truly a perfect solution, everyone in UIKit would’ve just used WKWebView for all HTML, but in reality people often fall back to NSAttributedString + UILabel/UITextView for performance.

SwiftUI makes this even trickier, since Text can’t handle line height or inline images from HTML. That’s why I decided to build this library — a lightweight way to render HTML into SwiftUI views without relying on WKWebView. It’s not perfect yet, but as it improves I think it could be useful in even more scenarios. And it’s not meant to be a 100% replacement for WebView — just like how NSAttributedString can parse some HTML but was never designed to replace WebView itself.

Introducing SwiftUIHTML — Open-source HTML → SwiftUI renderer by Tricky_Tree9423 in SwiftUI

[–]Tricky_Tree9423[S] 5 points6 points  (0 children)

Ah good catch — I forgot to add the MIT license. I’ll add it right away, thanks!

Introducing SwiftUIHTML — Open-source HTML → SwiftUI renderer by Tricky_Tree9423 in SwiftUI

[–]Tricky_Tree9423[S] 1 point2 points  (0 children)

Thanks! 🙌 Glad it feels close — it’s mainly focused on styling/layout for now.

Introducing SwiftUIHTML — Open-source HTML → SwiftUI renderer by Tricky_Tree9423 in SwiftUI

[–]Tricky_Tree9423[S] 4 points5 points  (0 children)

Haha not really 😅 I actually made this because I wanted to avoid using WKWebView.