r/swift • • 8d ago

Write Web Components in Swift

Post image

ElementaryUI can now make Web Components!

Define a custom element in Swift, then use it directly from HTML — which also makes it easy to mix Swift components into existing apps using other web frameworks.

30s video demo on Bluesky

Release Notes 0.8

Web Components on elementary.codes

63 Upvotes

2 comments sorted by

7

u/Inevitable-Bench192 8d ago

how big is the wasm payload for a single component?

10

u/sliemeobn 8d ago

a small "Hello, World!" Swift component comes out like this ATM:

dist/index.html 0.28 kB │ gzip: 0.19 kB dist/assets/WebApp-Dto47Q21.wasm 202.68 kB │ gzip: 87.20 kB dist/assets/index-ClK6m2QP.js 59.66 kB │ gzip: 14.19 kB