Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bring-shrubbery/svg-to-swiftui
Tool to convert SVG to SwiftUI's Shape structure.
https://github.com/bring-shrubbery/svg-to-swiftui
svg swift swiftui swiftui-shape transpiler
Last synced: 13 days ago
JSON representation
Tool to convert SVG to SwiftUI's Shape structure.
- Host: GitHub
- URL: https://github.com/bring-shrubbery/svg-to-swiftui
- Owner: bring-shrubbery
- License: apache-2.0
- Created: 2020-04-07T16:26:27.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-06-22T14:58:09.000Z (5 months ago)
- Last Synced: 2024-07-11T13:57:26.824Z (4 months ago)
- Topics: svg, swift, swiftui, swiftui-shape, transpiler
- Language: TypeScript
- Homepage: https://svg-to-swiftui.quassum.com
- Size: 131 MB
- Stars: 924
- Watchers: 9
- Forks: 37
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# SVG to SwiftUI Converter
Tool to convert SVG to SwiftUI's Shape structure. This approach is much more memory efficient than introducing a SVG library for rendering.
## Disclaimer (Before you use this tool)
This tool is oriented towards specific implementations where you might otherwise need to convert the icon into SwiftUI Shape manually, for example when you need a custom animatable icon, need to use SFSymbol in your macOS app, etc. For general purpose icons it might be better to use [this](https://developer.apple.com/documentation/uikit/uiimage/creating_custom_symbol_images_for_your_app) guide to create an SF Symbol instead.
## Quick Links
- [Web App (SVG to SwiftUI)](https://svg-to-swiftui.quassum.com?utm_source=github&utm_medium=readme)
- [Figma Plugin](https://dub.sh/figma-to-swiftui)## Usage
### Step 1
⭐️ Star this repository! ⭐️
### Online
The tool is available online, just follow [this](https://svg-to-swiftui.quassum.com/) link.
### Running locally
```
git clone https://github.com/bring-shrubbery/SVG-to-SwiftUI
cd SVG-to-SwiftUI
yarn
yarn dev
```## Example usage
To demonstrate this tool I created a thicc plus sign with rounded corners (created it in Sketch, so shapes from Sketch should work fine with this tool).
It's saved as `content/demo-plus.svg` file in this repository. You can see below how it looks like in the browser, and how it looks like after converting into SwiftUI Shape.### In the browser
![SVG file wiewed in the browser](content/example_svg.png)
### In SwiftUI View, exported as a Shape
![SVG file wiewed in the browser](content/example_swift.png)
## Contributing
- Feel free to open an issue for the SVG code that did not work - provide the SVG code of course!
- Pull requests are very welcome! Introducing support for more SVG element types would be the best contribution at this point.## Author
[Antoni Silvestrovic](https://github.com/bring-shrubbery)
[!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/bring.shrubbery)
## License
[MIT](https://github.com/bring-shrubbery/SVG-to-SwiftUI/blob/master/LICENSE)