Display and interact with SVG Images on iOS / OS X, using native rendering (CoreAnimation)
The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:
SVGKit is a Cocoa framework for rendering SVG files natively: it's fast and powerful. Some additional info and links are on the wiki
Latest info at: https://github.com/SVGKit/SVGKit/wiki/Versions
You have 3 main options for installing SVGKit:
NB: the "static library" is our backwards-compatible, manual install that always works if you have problems with CocoaPods/Carthage/Framework.
NB: Frameworks are the preferred way to use libraries in Xcode. But this is a new feature, it might have bugs. If you have ANY problems, please create an Issue, but also try the Static Library method below
You MAY also need to manually add the following Apple Frameworks to your app: - CoreText - CoreImage - libxml2.dylib - QuartzCore - CoreGraphics - UIKit
You MAY also need to add the following 3rd party Frameworks to your app (included with SVGKit): - CocoaLumberjack (in the SVGKit-iOS project, select the "3rd-party-frameworks" folder, and drag/drop whichever versions you need: iOS, tvOS, etc) Remember to embed the library too (should show under Target -> General -> Embedded Binaries)
CocoaPods is a dependency manager for CocoaTouch. To do CocoaPods, adding the following in your podfile:
It is also recommended that you setup your podfile to get SVGKit from the latest branch (October 2018: currently 3.x).
pod 'SVGKit', :git => 'https://github.com/SVGKit/SVGKit.git', :branch => '3.x'
Carthage is a decentralized dependency manager for Cocoa. To use Carthage, adding the following in your Cartfile:
It is also recommended that you setup your Cartfile to get SVGKit from the current version (October 2018: 3.x branch).
github "SVGKit/SVGKit" "3.x"
We have a build script that automatically builds ALL versions of the library at once, and ships them as a single file: http://stackoverflow.com/questions/3520977/build-fat-static-library-device-simulator-using-xcode-and-sdk-4/3647187#3647187
It's all setup already, all you need to do is:
Everything else is automatic.
Added in version 2.1.0 / Autumn 2018: support for macOS.
You can use nearly the same API like iOS. Including
SVGKLayeredImageView, and you can use
SVGKImage.NSImageto export SVG layer to bitmap image.
We also provide a macOS demo for SVGKit. To run the Demo, open
Demo-OSX.xcodeprojand built to run. You can browser the different SVG files using those two different type of view to check the compatibility.
Here are some old posts (some of these APIs have changed slightly since they were written) on using SVGKit, with advice on which methods to use and why:
CONTRIBUTING to the project, CORE ARCHITECTURE: http://t-machine.org/index.php/2012/12/31/svgkit-2013-development/
(November 2013): New (experimental) feature - writing SVG's out to disk, preserving any changes you made programmatically: http://t-machine.org/index.php/2013/11/17/svgkit-programmatic-editing-of-svg-files-on-ios/
Using SVGFastImageView in SwiftUI: https://gist.github.com/ozgurshn/c816a035ff4722dc26650f4a4ed40105