svg-to-swiftui-core v0.4.0 is a JavaScript/TypeScript library that converts raw SVG code into SwiftUI Shape structs that can be directly used in SwiftUI projects. It currently supports SVG <path> (partial), <circle>, <rect>, and <ellipse> elements. The package depends on svg-parser and svg-pathdata for parsing. It is designed for Node.js environments and provides an ESM-only API via the default export. The library is in early development (pre-1.0) with limited command support and no styling or animation features.
npm install svg-to-swiftui-coreNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Converts an SVG circle string to a SwiftUI Shape struct and writes it to a file.
Ensure SVG paths only use M, L, H, V, Z commands; avoid curves and arcs.
Use import instead of require, or use dynamic import().
Read SVG file or fetch SVG content as string before calling convert.
Lock version to current minor version and test upgrades.
Use dynamic import: const { convert } = await import('svg-to-swiftui-core');Use import { convert } from 'svg-to-swiftui-core' instead of import convert from 'svg-to-swiftui-core'Simplify SVG path to only use M, L, H, V, Z commands.