{"repo":"swhitty/SwiftDraw","free":true,"listed":false,"github":"https://github.com/swhitty/SwiftDraw","clone":"git clone https://github.com/swhitty/SwiftDraw.git","description":"Native SVG parser and renderer for SwiftUI, UIKit and AppKit, with tools for PNG, PDF, SF Symbols and Swift source.","language":"Swift","stars":638,"topics":["ios","macos","svg-renderer","swift-package-manager","swiftui","uikit","vector-graphics","appkit","coregraphics","sfsymbol"],"license":"Zlib","category":"mobile-apps","readme_excerpt":"Introduction SwiftDraw displays SVG images natively in SwiftUI, UIKit and AppKit. It includes a pure-Swift SVG parser and renderer, plus a command-line tool for converting SVGs to PNG, PDF, custom SF Symbols and Swift source code. - Usage - SwiftUI - Loading and Transforming SVGs - UIKit - AppKit - Command Line Tool - Installation - SF Symbol - Alignment - Swift Code Generation - Credits Usage SwiftUI SVGView works much like SwiftUI’s built-in Image view: By default, the SVG is rendered at its intrinsic size. To make it flexible within layouts, mark it as resizable: SVGView works just like Image : - .scaledToFit() to scale proportionally so the SVG fits inside its container. - .scaledToFill() to fill the entire container, cropping if necessary. - .resizable(resizingMode: .tile) to repeat the SVG as tiles across the available space. SVGs can also be rendered as templates, replacing every non-transparent pixel with the current foreground style: .original .template :-----------: :-----------: When loading by name, SVGView maintains an internal cache for efficient repeated lookups. For more predictable performance (avoiding cache lookups or parsing), you can pass in an already-constructed SVG instance: Remote SVGs can be loaded using AsyncSVGView : For custom loading and error states, use the phase-based initializer: Loading and Transforming SVGs SVG images can be loaded and rasterized to UIImage or NSImage : Transformations can be added before rasterizing: UIKit Create a UIImage","default_branch":null,"files":null,"tree":[],"storefront":"/r/swhitty","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/swhitty/SwiftDraw/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}