richardpiazza/vectorplus
A library & utility for interacting with SVG documents.
Packages
VectorPlus
VectorPlus acts primarily as a wrapper over SwiftSVG providing extensions for interacting with:
CoreGraphicsUIKitAppKitSwiftUI
When linked to a target that supports one of these frameworks, multiple options become available.
CoreGraphics
CGMutablePath.addCommand(_:from:to:): Adds aPath.Commandto the mutable path. The addition of theRects allow for correct placement and scaling.
CGContext.render(path:from:to:) throws: Rendered aPathin the given context. Uses information about fills and strokes to fill and/or stroke the path.
UIKit
SVG.uiImage(size:) -> UIImage?: ACoreGraphicsrenderedUIImagerepresentation of the SVG paths.
SVG.pngData(size:) -> Data?: ADatarepresentation of theUIImage.
SVGImageView: AUIImageViewsubclass that supports the assignment of anSVGobject. The.imagewill automatically be generated using the viewbounds.
AppKit
SVG.nsImage(size:) -> NSImage?: ACoreGraphicsrenderedNSImagerepresentation of the SVG paths.
SVG.pngData(size:) -> Data?: ADatarepresentation of theNSImage.
SwiftUI
SVGView(svg:): ASwiftUI.Viewthat renders aSVGdocument.
Command Line Interface
Inspect
Parses an SVG document and prints out the document description.
Convert
Parses an SVG document and creates a PNG rendered version of the Commands.
Supported conversion options are:
- absolute: Translates all elements to 'absolute' paths.
- symbols: Generates an Apple Symbols compatible SVG.
- uikit: A
UIImageViewsubclass that supports dynamic sizing.
Preview
macOS only
Parses an SVG document displaying the results in an Application window. Do to limitations, this sub-command is only available when the AppKit framework is present.
Render
macOS only
Parses an SVG document and creates a PNG rendered version of the Commands. Do to limitations, this sub-command is only available when the AppKit framework is present.
Package Metadata
Repository: richardpiazza/vectorplus
Default branch: main
README: README.md