Svelte custom renderer #8598
|
This is becoming a thing now: Could Capacitor use this to do native renders of Svelte UIs? |
Replies: 1 comment
|
It could be a building block, but it would require a new native UI renderer/host implementation; enabling Svelte's compiler option alone would not make Capacitor render UIKit or Android views. The linked Svelte PR is still open as of September 21. Its Capacitor's current model is a web app running in a native container, with plugins exposing native platform capabilities. For native Svelte UI, somebody would additionally need to implement native element creation/update/removal, event handling, layout/styling, lifecycle, and the connection between Svelte's JS runtime and the iOS/Android view hierarchy. Existing DOM-dependent Svelte components would also need review. So there are two distinct paths: ordinary Svelte + Capacitor already works for WebView UI; Svelte custom renderer + a native view backend is a separate integration project. Capacitor plugins could help host native surfaces, but Capacitor itself doesn't supply that Svelte-to-native renderer today. |
It could be a building block, but it would require a new native UI renderer/host implementation; enabling Svelte's compiler option alone would not make Capacitor render UIKit or Android views.
The linked Svelte PR is still open as of September 21. Its
experimental.customRendereroption changes compiled components to call a supplied renderer instead of assuming the browser DOM. The example renderer in the PR targets a terminal, which illustrates the boundary: the renderer still has to implement the destination UI operations.Capacitor's current model is a web app running in a native container, with plugins exposing native platform capabilities. For native Svelte UI, somebody would addition…