Display and interact with SVG Images on iOS / OS X, using native rendering (CoreAnimation)

Related tags

Graphics SVGKit
Overview

SVGKit

SVGKit is a Cocoa framework for rendering SVG files natively: it's fast and powerful. Some additional info and links are on the wiki

Versions:

Latest info at: https://github.com/SVGKit/SVGKit/wiki/Versions

  • v3.x = current "in development" branch with latest changes, fixes, features
    • NB: this is now automatically selected in GitHub as the "default" branch when you visit SVGKit's project page

Getting Started

Run the Demo - iOS

  1. Open up "Demo-iOS.xcodeproj", and run it (on simulator or device). Try different SVG's. Zoom, pan, and (with the Monkey only:) hit the "Animate" button. Tap the images to see bounding-boxes / hit dectection (might need you to hit the Debug button first)
  2. If you have ANY problems building the library and embedding it in your app, compare your build settings to the Demo-iOS build settings - if something's different, it's probably the problem.

Installation (add SVGKit to your app)

You have 3 main options for installing SVGKit:

  1. Drag/drop the .framework file into your project <-- PREFERRED / RECOMMENDED
  2. Use CocoaPods
  3. Use Carthage
  4. Drag/drop the static library into your project, and configure the build settings in your project

NB: the "static library" is our backwards-compatible, manual install that always works if you have problems with CocoaPods/Carthage/Framework.

OPTION 1: Use the Framework - drag, drop, done!

  1. Open "SVGKit-iOS.xcodeproj"
  2. Build the project once
  3. In Project Navigator, expand the Products folder
  4. Drag/drop SVGKit.framework into your app-project

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)

OPTION 2: Using CocoaPods

CocoaPods is a dependency manager for CocoaTouch. To do CocoaPods, adding the following in your podfile:

pod 'SVGKit'

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'

OPTION 3: Using Carthage

Carthage is a decentralized dependency manager for Cocoa. To use Carthage, adding the following in your Cartfile:

github "SVGKit/SVGKit"

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"

OPTION 4: Build the static library

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:

  1. Open "SVGKit-iOS.xcodeproj", switch to "SVGKit-iOS" target and Build it (cmd-B)
  2. in left navbar, scroll to bottom, and open the "Products" section
  3. right click the library ("libSVGKitBLAHBLAH.a") and select "show in finder"
  4. GO UP ONE FOLDER
  5. select the "Debug-universal" (or Release-universal if you were building in Release mode) folder
  6. Drag/drop the .a file and the "usr" folder into your project (select the "Copy files" checkbox)
  7. In Build Settings, select "Other Linker Flags" and add "-ObjC"
  8. Edit your build settings and set "C/C++ Compiler Version" = "LLVM Compiler 2.0"
  9. Add ALL the frameworks and 3rd party libraries listed below (go to "Build Phases", and "Link Binary with Libraries"):
  • CoreText
  • CoreImage
  • libxml2.dylib
  • QuartzCore
  • CoreGraphics
  • UIKit

Everything else is automatic.

Usage - OS X

Added in version 2.1.0 / Autumn 2018: support for macOS.

You can use nearly the same API like iOS. Including SVGKFastImageView, SVGKLayeredImageView, and you can use SVGKImage.NSImage to export SVG layer to bitmap image.

We also provide a macOS demo for SVGKit. To run the Demo, open Demo-OSX.xcodeproj and built to run. You can browser the different SVG files using those two different type of view to check the compatibility.

Recipes for using the library

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:

Comments
  • Fix the implementation of radial gradient and linear gradient

    Fix the implementation of radial gradient and linear gradient

    Summary

    This is a render fix, for both radialGradient and linearGradient to match most of SVG files rendering on WebKit browser like Chrome or Safari.

    Current issue

    The current implementation for radialGradient && linearGradient contains many issues. Let me show it one by one.

    1. <radialGradient> not works for SVGLayeredImageView at all. Always show empty result. (Reason: SVGGradientLayer override drawInContext: method will not works for CA render server, which is used for SVGLayeredImageView hardware-rendering.)
    2. <linearGradient> in SVGFastImageView contains strange bounding rects, like the demo SVG images firefox_logo_2013 below. (Reason: Apple's bug for CAGradientLayer on iOS. Works well on macOS, suck)
    3. <radialGradient> does not supports standard fx, fy, fr properties, cause many valid SVG render failed.

    Changes detail

    • Seperate the two class and follow SVG spec about the DOM interface SVGRadialGradientElement && SVGLinearGradientElement.
    • Refactory the SVGGradientLayer implementations, to supports correct software-rendering for radial gradienrt && linear gradient. Thansk for IJSVG this third-party framework for code reference. I reference his implementation and port it to SVGKit.
    • Supports fx, fy, fr on <radialGradient>

    Solved issue

    1. Solved. because SVGLayeredImageView using CA render server and hardware rendering. It does not call any of your renderInContext: code. Apple's CAGradientLayer contains a type kCAGradientLayerRadial for radial gradient, So I use this for hardaware-rendering. However, it does not supports any focal point (suck Apple...). Anyway, at least all non-focal point radial gradient can now been rendering on SVGLayeredImageView.
    2. Solved perfectly.
    3. Solved perfectly using SVGFastImageView. However, these properties will be totally ignored for SVGLayeredImageView (See the reason above)

    Compare between fix

    See comments below since there are many images.

    Demo

    I also update the iOS demo because it hard-coded to use SVGFastImageView and I want to test SVGLayeredImageView as well. However, to simplify the review from @adamgit, I create another branch for that changes (only about demo changes, not about Core Framework).

    See changes in my fork branch : bugfix_radial_gradient_demo. After all review done, I can create MR again.

    opened by dreampiggy 23
  • Demo-iOS PreserveAspectRatio crashed with iOS simulator (iPhone5s + iOS8)

    Demo-iOS PreserveAspectRatio crashed with iOS simulator (iPhone5s + iOS8)

    Hello

    Demo App crashed when choose PreserveAspectRatio on iOS simulator. Simulator running on iOS 8 with iPhone5s setup.

    Anyone have same problem?

    Warning: Error creating LLDB target at path '/Users/key/Library/Developer/Xcode/DerivedData/Demo-iOS-cufjeqyrxikvkfbxdqvtlbjvypzk/Build/Products/Debug-iphonesimulator/Demo-iOS.app'- using an empty LLDB target which can cause slow memory reads from remote devices.
    2014-09-17 17:34:26:405 Demo-iOS[52249:607] [SVGKFastImageView] WARNING: you have initialized an SVGKImageView with a blank image (nil). Possibly because you're using Storyboards or NIBs which Apple won't allow us to decorate. Make sure you assign an SVGKImage to the .image property!
    2014-09-17 17:34:26:421 Demo-iOS[52249:2703] [SVGLength] WARNING: you are running on the simulator; it's impossible for us to calculate centimeter/millimeter/inches units correctly
    2014-09-17 17:34:26:421 Demo-iOS[52249:2703] Found unexpected preserve-aspect-ratio command inside element's 'preserveAspectRatio' attribute. Command = ''
    2014-09-17 17:34:26:421 Demo-iOS[52249:2703] [SVGSVGElement] DEBUG INFO: set document viewBox = {{-1, -1}, {-1, -1}}
    2014-09-17 17:34:26:421 Demo-iOS[52249:2703] [SVGKParser] WARN: found a tag with no namespace parser: (</desc>), using default parser(<SVGKParserDOM: 0x7b64bb00>)
    2014-09-17 17:34:26:426 Demo-iOS[52249:2703] Allocating static NSCharacterSet containing whitespace characters. Should be small, but Apple seems to take up 5+ megabytes each time?
    2014-09-17 17:34:26:426 Demo-iOS[52249:2703] unsupported command A
    2014-09-17 17:34:26:427 Demo-iOS[52249:2703] [SVGSVGElement] DEBUG INFO: set document viewBox = {{0, 0}, {30, 40}}
    2014-09-17 17:34:26:427 Demo-iOS[52249:2703] unsupported command A
    2014-09-17 17:34:26:428 Demo-iOS[52249:2703] [SVGSVGElement] DEBUG INFO: set document viewBox = {{0, 0}, {30, 40}}
    2014-09-17 17:34:26:428 Demo-iOS[52249:2703] unsupported command A
    2014-09-17 17:34:26:429 Demo-iOS[52249:2703] [SVGSVGElement] DEBUG INFO: set document viewBox = {{0, 0}, {30, 40}}
    2014-09-17 17:34:26:430 Demo-iOS[52249:2703] unsupported command A
    2014-09-17 17:34:26:430 Demo-iOS[52249:2703] [SVGSVGElement] DEBUG INFO: set document viewBox = {{0, 0}, {30, 40}}
    2014-09-17 17:34:26:430 Demo-iOS[52249:2703] unsupported command A
    2014-09-17 17:34:26:431 Demo-iOS[52249:2703] [SVGSVGElement] DEBUG INFO: set document viewBox = {{0, 0}, {30, 40}}
    2014-09-17 17:34:26:431 Demo-iOS[52249:2703] unsupported command A
    2014-09-17 17:34:26:431 Demo-iOS[52249:2703] [SVGSVGElement] DEBUG INFO: set document viewBox = {{0, 0}, {30, 40}}
    2014-09-17 17:34:26:432 Demo-iOS[52249:2703] unsupported command A
    2014-09-17 17:34:26:432 Demo-iOS[52249:2703] [SVGSVGElement] DEBUG INFO: set document viewBox = {{0, 0}, {30, 40}}
    2014-09-17 17:34:26:433 Demo-iOS[52249:2703] unsupported command A
    2014-09-17 17:34:26:433 Demo-iOS[52249:2703] [SVGSVGElement] DEBUG INFO: set document viewBox = {{0, 0}, {30, 40}}
    2014-09-17 17:34:26:433 Demo-iOS[52249:2703] unsupported command A
    2014-09-17 17:34:26:434 Demo-iOS[52249:2703] [SVGSVGElement] DEBUG INFO: set document viewBox = {{0, 0}, {30, 40}}
    2014-09-17 17:34:26:434 Demo-iOS[52249:2703] unsupported command A
    2014-09-17 17:34:26:434 Demo-iOS[52249:2703] [SVGSVGElement] DEBUG INFO: set document viewBox = {{0, 0}, {30, 40}}
    2014-09-17 17:34:26:435 Demo-iOS[52249:2703] unsupported command A
    2014-09-17 17:34:26:435 Demo-iOS[52249:2703] [SVGSVGElement] DEBUG INFO: set document viewBox = {{0, 0}, {30, 40}}
    2014-09-17 17:34:26:436 Demo-iOS[52249:2703] unsupported command A
    2014-09-17 17:34:26:436 Demo-iOS[52249:2703] [SVGSVGElement] DEBUG INFO: set document viewBox = {{0, 0}, {30, 40}}
    2014-09-17 17:34:26:437 Demo-iOS[52249:2703] unsupported command A
    2014-09-17 17:34:26.438 Demo-iOS[52249:658958] [DetailViewController] WARNING: workaround for Apple bugs: UIScrollView spams tiny changes to the transform to the content view; currently, we have NO WAY of efficiently measuring whether or not to re-draw the SVGKImageView. As a temporary solution, we are DISABLING the SVGKImageView's auto-redraw-at-higher-resolution code - in general, you do NOT want to do this
    2014-09-17 17:34:26:439 Demo-iOS[52249:607] [SVGKImage] WARNING: no CALayer tree found, creating a new one (will cache it once generated)
    Assertion failed: (CGFloatIsValid(x) && CGFloatIsValid(y)), function void CGPathMoveToPoint(CGMutablePathRef, const CGAffineTransform *, CGFloat, CGFloat), file Paths/CGPath.cc, line 254.
    
    opened by key 22
  • SVGKLayer was deallocated while key value observers were still registered with it - iOS8.0

    SVGKLayer was deallocated while key value observers were still registered with it - iOS8.0

    Hi guys,

    Thanks for the amazing work on SVGKit.

    There is a bug on iOS8.0 that makes the app crash. This also manifests with warnings on iOS7+.

    When using SVGKLayeredImageView, once it gets deallocated it sends the following exception:

    "*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'An instance 0x7f847d8b8970 of class SVGKLayer was deallocated while key value observers were still registered with it. Current observation info: <NSKeyValueObservationInfo 0x7f847d8b92a0> ( <NSKeyValueObservance 0x7f847d884570: Observer: 0x7f847d8b8970, Key path: showBorder, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x7f847d894250>"

    While on iOS7 the same happens but it does not break the app. I'm aware of a similar issue on the observers added to the DOMTree.viewport and i'm removing those on dealloc. But it does not solve the SVGKLayer issue.

    opened by bsousa156 21
  • Applying fill color to a SVGImage / SVGImageView

    Applying fill color to a SVGImage / SVGImageView

    How is it possible to color fill an SVGImage or SVGImageView? I've been trying to loop through the sublayers of these objects and all I get are CALayers that do not have any fillColor property... I can't seem to find any CAShapeLayers anywhere...

    Any suggestions?

    opened by sarperdag 20
  • Resizing SVGs

    Resizing SVGs

    Is there a way to resize the SVG that is displayed via SVGKit?

    I've tried displaying on iOS through SVGView/SVGDocumentView, but they don't seem to respond to frame/bounds changes.

    I'm guessing this is because it is added directly as a CALayer and the SVGView doesn't resize its sublayers?

    Please let me know if you can provide any insight.

    opened by jverdi 20
  • Add macOS support in 2.x

    Add macOS support in 2.x

    @adamgit Hi. I'm the author of SDWebImageSVGCoder, a SVG coder plugin for SDWebImage (A iOS image loading system). Since I want to support macOS (for simply usage, but not expert user), I found that the readme of this repo, point out to let user to use the MaddTheSane/SVGKit fork.

    However, his fork master branch is far away from current 2.x branch and it won't compile on Xcode 10. The author change too much of existing APIs and write some custom logic. So it's not easy to merge. So I decide to try it by myself, by taking minimal changes to current core code to bring it to macOS platform.

    For macOS user, we can just simply treate NSImage as UIImage, NSView as UIView, and more, so current UIImage exporter can be also used for macOS. Then, I grab the MaddTheSane's SVGKImageRep class (which is one important for macOS but not iOS). After I fix all the compile issue, it seems the framework can work on macOS now.

    No changes to current code on iOS/tvOS user. Just using the alias and fix some cross-platform code to make it work on macOS. You can see the diff. Some changes are related to project structure. For example, we re-defined the same pch files, umbrella header files for each target, however the content are nearlly same so I put them into single one to simplify the problem.

    If someone is interested in this, please review this. There may be some little issue (I run a simple demo on macOS and it works. But for large project it may not).

    opened by dreampiggy 19
  • CocoaPods for '2.x' broken?

    CocoaPods for '2.x' broken?

    I'm trying to import SVGKit into my Swift tvOS project via CocoaPods and it's not working. I'm a newbie to both Swift development and CocoaPods, so I may be doing something wrong here.

    I've added SVGKit to my podfile as such:

    pod 'SVGKit', :git => 'https://github.com/SVGKit/SVGKit.git', :branch => '2.x'
    

    There are no errors upon installation and a folder for SVGKit is created (as well as for CocoaLumberjack). But the folder for SVGKit is empty both in the project file as well as on disk. From this point, I have no idea if it actually installed properly, and if so, how to import it.

    screen shot 2015-12-20 at 3 52 21 am

    This post suggests that CocoaPods should work fine but gives no instructions. Issue #189 also asks about using SVGKit with Swift, but the instructions on that thread seem to suggest that I need to manually download/import/configure, something I was hoping CocoaPods would do for me.

    Thanks in advance!

    opened by btraut 19
  • Updated podspec so it will actually build when added as a pod to a project

    Updated podspec so it will actually build when added as a pod to a project

    With these changes users can use pod 'SVGKit', :git => 'https://github.com/SVGKit/SVGKit.git' to install SVGKit as a Cocoapod. Ideally we would replace the outdated v1.0 that is in the Cocoapods spec repo, but to do that you would have to transition to tagging releases, the podspec works as is but it does throw a warning that it is just pointing to the 1.x branch instead of a tag. The Cocoapod's team doesn't accept pod specs with warnings.

    Going forward on development with SVGKit here are a couple things to be aware of.

    1. If you add any new source files outside the current directory structure or add new sub directories you will need to update the pod spec's s.ios.source_files to include that path.
    2. CocoaLumberjack will be included as a dependency. This means it will use the latest published CocoaLumberjack version, and not the version you have been including in the project so far. This fixes cases where people add SVGKit to their app and they have a conflict since their app or another lib it uses had also included CocoaLumberjack.
    opened by amayers 18
  • Unable to render a (simple?) gradient polygon.

    Unable to render a (simple?) gradient polygon.

    I was experimenting with this library and I tried to load one of my SVG's which were manipulated through InkScape, unfortunately with no luck. The renderer was unable to render the file if it had gradient fills in it.

    In your demos, this seems to be supported, so I managed to create a minimun implementation to present this problem. The file can be downloaded from http://www.panayotis.com/polygon.svg (unfortunately github didn't allow me to upload an SVG file).

    It is a yellow polygon in front of a red square. The red square could be rendered, but the yellow polygon not.

    Can you direct me to any solution to this problem? Thank you.

    opened by teras 18
  • path is not rendered

    path is not rendered

    I don't know why and how to fix this but this svg path isn't rendered. It show well in a browser. Am i missing something ?

    <?xml version="1.0"?>
    <svg xmlns="http://www.w3.org/2000/svg" width="593" height="200" version="1.0" id="ezcGraph">
        <path d="M 2.50,101.00 L 378.40,101.00 A 81.90,57.52 0 0,1 283.45,157.78 Z" style="fill:#000000;" id="ezcGraphCircleSector_51"/>
    </svg>
    

    Best regards

    opened by GeraudBourdin 17
  • DDLogCWarn is not a thing as far as I can tell

    DDLogCWarn is not a thing as far as I can tell

    Throughout the code you have references to DDLogCWarn and I get many compilation errors because of it. I changed them all to DDLogWarn and it compiles just fine.

    However, I also had to change Pods-SVGKit-prefix.pch to import CocoaLumberjack.h instead of DDLog.h to get rid of "implicit declaration" warnings and indeed compilation errors as well for other log levels used.

    Is this indeed a bug or am I missing something after I updated my pods?

    opened by geraldcor 17
  • CFNetwork: Synchronous URL loading of xxxxxx.svg should not occur on this application's main thread

    CFNetwork: Synchronous URL loading of xxxxxx.svg should not occur on this application's main thread

    Synchronous URL loading of xxxxxx.svg should not occur on this application's main thread as it may lead to UI unresponsiveness. Please switch to an asynchronous networking API such as URLSession.

    Why?

    opened by petkrein 0
  • `CocoaLumberjack` build issues

    `CocoaLumberjack` build issues

    New Issue Checklist

    • [✅] I have read and understood the CONTRIBUTING guide
    • [✅] I have reproduced the problem while running in Xcode, and read the Console log, and acted upon any relevant error or warning messages
    • [N/A] I have reproduced the problem while running in Xcode's Debugger, and used breakpoints to examine the actual values of variables vs the expected values
    • [ ✅] I am not using CocoaPods, or: I am using CocoaPods, but have verified my podspec points to SVGKit v2.x

    Issue Description and Steps

    Hey everyone! I was wondering if anyone's still had the CocoaLumberjack minimum version issue that has been brought up here before. My project's using SPM and currently I get either one of two errors: A. If my dependency is set on Version: Up to Next Major 3.0.0, then I see:

    The package product 'CocoaLumberjack' requires minimum platform version 11.0 for the iOS platform, but this target supports 9.0
    

    B. If my dependency is set on the branch 3.x, then I see:

    'CocoaLumberjack/CocoaLumberjack.h' file not found
    

    Not sure if I'm missing something, but has anyone encountered anything similar?

    opened by lxalfonso 2
  • Crash when the SVG width/height is set to autp

    Crash when the SVG width/height is set to autp

    New Issue Checklist

    • [x] I have read and understood the CONTRIBUTING guide
    • [x] I have reproduced the problem while running in Xcode, and read the Console log, and acted upon any relevant error or warning messages
    • [x] I have reproduced the problem while running in Xcode's Debugger, and used breakpoints to examine the actual values of variables vs the expected values
    • [ ] I am not using CocoaPods, or: I am using CocoaPods, but have verified my podspec points to SVGKit v2.x

    Issue Description and Steps

    In some cases when the SVG's width/height is set to auto the app crashes: example svg

    *** Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [nan nan]' I've found that if in CSSPrimitiveValue.m in the case of the unhandled CSS_STRING I return a non-zero value (f.e. 600) the app works correctly and SVG is rendered correctly.

    opened by arturdev 0
  • Running on iPod 7G reports an NSAssert

    Running on iPod 7G reports an NSAssert

    New Issue Checklist

    • [ x] I have read and understood the CONTRIBUTING guide
    • [ x] I have reproduced the problem while running in Xcode, and read the Console log, and acted upon any relevant error or warning messages
    • [x ] I have reproduced the problem while running in Xcode's Debugger, and used breakpoints to examine the actual values of variables vs the expected values
    • [ x] I am not using CocoaPods, or: I am using CocoaPods, but have verified my podspec points to SVGKit v2.x

    Issue Description and Steps

    Crashlytics reports:

    Fatal Exception: NSInternalInconsistencyException
    Update your source code or disable assertions: you are using an iPod that didn't exist when this code was written, we have no idea what the pixel count per inch is!
    

    Fix :

    In SVGLength.m change

    if( [platform hasPrefix:@"iPod4"]
    	   || [platform hasPrefix:@"iPod5"]
    	   || [platform hasPrefix:@"iPod7"])
    		return 326.0f;
    

    to

    if( [platform hasPrefix:@"iPod4"]
    	   || [platform hasPrefix:@"iPod5"]
    	   || [platform hasPrefix:@"iPod7"])
               || [platform hasPrefix:@"iPod9"])
    		return 326.0f;
    
    opened by timbms 1
  • new version

    new version

    Can you create new version with .iOS(.v11)?? We have minimal iOS version 11 in app.

    If we use 3.0.0 (minimal iOS 9) version we have error with Cocoalimberjack v 3.8.0 (minimal iOS 11)

    You can use my last commit

    .package(url: "https://github.com/CocoaLumberjack/CocoaLumberjack.git", .upToNextMinor(from: "3.7.0"))

    OR update .iOS(.v9) to .iOS(.v11)

    opened by freddiebo 0
Releases(3.0.0)
  • 3.0.0(Apr 15, 2021)

    This is a convenience release pulling all current 3.x features into one, and allowing us to make major changes afterwards with new releases.

    Source code(tar.gz)
    Source code(zip)
  • 2.1.0(Oct 30, 2018)

    FINAL major release on the 2.x branch. All future development will be on the new 3.x branch.

    KEY CHANGES

    • Improved alpha/color/transparency handling
    • Improved/fixed changes introduced by iOS 7/8/9/10
    • Updated to add support to iPhones 7/8/9/X
    • Added support for building projects that include Apple Watch
    • Added support for building projects that include tvOS
    • Fixed some edge-cases in smooth curves
    • Fixed some edge-cases in elliptical paths
    • Updated Cocoa Lumberjack to 3.x
    • Handled some possible errors with loading from URL
    • Improved Carthage settings
    • Improved CocoaPods settings
    • Fixed the zooming code provided in the Demo projects
    • Improved support for measurements in Inches and Centimetres
    • Converted to ARC

    CONTRIBUTORS

    • @dreampiggy
    • @efirestone
    • @amcalgates
    • @pwesten
    • @beanandbean
    • @Speakus
    • AS/JF
    • @RenGate
    • @spromicky
    • @avinashdongarwar
    • @aronkool
    • @sushihangover
    • @cpboyd
    • @vitalii-tym
    • Josh Berkheimer
    • @Nonouf
    • @rawrmaan
    • @victorsosa
    • @cpboyd
    • @lakario
    • @petertribe
    • @brunogama
    • Marcel Schmitz
    • @ReadmeCritic
    • @alexandre-g
    • @cxa
    • @JohnWong
    • @flemingm
    • @russellentrata
    • @MaddTheSane
    • @adamgit
    Source code(tar.gz)
    Source code(zip)
  • 2.0.0(Jan 9, 2016)

    First major release on the 2.x branch.

    This is the version most of us have been using in production for over a year, with live fixes and updates.

    KEY CHANGES

    • Cleaner integration of CocoaLumberjack, + upgraded to Lumberjack v2.0.0
    • Many improvements to SVG shape parsers, support many more SVG files
    • Full test-suite from W3C (hundreds of SVGs you can test in the demo app)
    • Many improvements to CSS parsing, support for many more CSS rules and features
    • Support more features of Gradient rendering
    • Better text-handling (still not great: someone please take the old fork that uses CoreText instead of CATextLayer and update + merge it!)
    • Better support for Retina devices

    All features / additions / fixes compared to v1.2:

    Fixed two minor memory leaks Fixed issue where SVG height was getting scaled to 0 Fix set didRegisterInternalRedrawObservers to false after removing observers Fix spelling errors in flag names Add failing tests for setting image multiple times on SVGKFastImageView Support iPad Pro Add info on using the latest SVGKit with cocoapods added bundle to convenience initializer method passing bundle via paramter instead of global state added setBundle feature to SVGKSourceLocalFile integrated CocoaLumberjack as library dependency Added iPhone 6s and 6s Plus support Custom context logging for SVGKit LineTo pairs can be separated by comma. Support visibility:hidden and display:none Support dashes and underscores in selectors Support https: prefix for SVGImageElement Fixed many compiler warnings Fixed several memory leaks Replace default font on text elements. Fix the z command so that it returns the current point of path Fix for SVGs which have radius larger than w/h ADDED: complete W3C official TestSuite for SVG ADDED: SVGKSource and all subclasses now support NSCopying Radial gradients with objectBoundingBox are now scaled and translated Fix the handling of the element Fix relative positioning bug in elliptical arcs. Add support for the elliptical arc command in paths Updating CocoaLumberjack to 2.0.0. Improvements for userSpaceOnUse linear gradients ADDED: better error-handling for bad URLs and for when there's no internet Fixed some obscure crashing bugs in parser Improve linear gradient handling for objectBoundingBox units fixes some potential data loss silencing a few warnings Add support for relative lengths to circles, ellipses and lines Do some preprocessing on data urls by removing whitespace More robust inline style parsing Convert inches to inches Provides basic support for the SVG element Add support for skewX and skewY transformations Fixed a bug with 'Smooth Curveto' and 'Smooth Quadratic Curveto' path Added demo example file to test radial gradient opacity fix Fixed crash on iOS 8 if any CAShapeLayer is empty Fixed crash when changing a SVGKLayeredImageView image Fixed bug on conversion from millimeter to inches and inches to milimeters Improve parsing to avoid redundant copying and stack allocation Remove synthesizers of child properties More robust test cases Only apply clipping masks to elements that have the clip-path attribute, not to their children too iPad Air 2 Compatibility pass CGPathElement instead of CGPoint fix CGPoint iterator (C array) Fix iOS 8 bug with assert fail on infinity CGFloat Implement retain-release tests for the iOS framework Improve stringFromSource to use the NSData+NSInputStream category. Remove Element.h import Updating the project settings so NSAssert does not get raised on production builds Fix for external stylesheets to open the stream before reading from it. Add support for the textArea element from TinySVG 1.2. Improve SVGTextElement to have support for text-anchor and fill Handle viewBoxes with no white space -- for example, viewBox="0,0,100,100" Allow white space delimited lists in SVG css attributes Add support for stroke-dasharray attribute FIXED: Loading images from the web via SVGKSourceURL Fixed how SVG-source images are rendered. Changed to support retina resolution when making a bitmap mask. Change SVGTextElement to not render blocky text on retina displays ADDED: Can load SVG files from NSData sources, with working URL relative Add ImageAspectRatio sample to the demo app. Implemented preserveAspectRatio for images. Finished implementation of Added the ability to load SVG images from relative URLs. fix memory leak of NSDates Change CLANG_CXX_LIBRARY to libc++ in the podspec Fixed "rotate" transform type.

    EXPERIMENTAL (these are included in 2.0.0 but are not active by default - you can use them)

    using SVGKit.h file as framework header

    CONTRIBUTORS

    @rhcad @andmar1x @ArcRain @dpletter @sweetmandm @dpletter @newmaniese @samskiter @Requilence @MaddTheSane gaunts Jorge Ouahbi @buscarini imac @Anubis88 @tonyd256 @BrandonZacharie @chuckhendo @BadPirate @freeatnet @alaija @dgileadi @Dschee @seltzered @amcalgates @sciutand @russellentrata @flemingm @alexandre-g @gumob @rance-attack @guylachish @edave Bjørn Olav Ruud

    Source code(tar.gz)
    Source code(zip)
Owner
null
iOS utility classes for asynchronous rendering and display.

YYAsyncLayer iOS utility classes for asynchronous rendering and display. (It was used by YYText) Simple Usage @interface YYLabel : UIView @property NS

null 672 Dec 27, 2022
A simple, performant, and lightweight SVG parser

Key Features Parsing performance that meets or beats other popular SVG Frameworks A simple architecture, optimized for extension, flexibility and deve

Michael Choe 1.8k Dec 29, 2022
Powerful and easy-to-use vector graphics Swift library with SVG support

Macaw Powerful and easy-to-use vector graphics Swift library with SVG support We are a development agency building phenomenal apps. What is Macaw? Mac

Exyte 5.9k Jan 2, 2023
SVG parser and renderer written in SwiftUI

SVGView SVG parser written in SwiftUI We are a development agency building phenomenal apps. Overview The goal of this project is to bring the full pow

Exyte 269 Jan 4, 2023
❄️ SVG in Swift

Snowflake ❤️ Support my apps ❤️ Push Hero - pure Swift native macOS application to test push notifications PastePal - Pasteboard, note and shortcut ma

Khoa 949 Dec 14, 2022
An iOS framework for easily adding drawings and text to images.

jot is an easy way to add touch-controlled drawings and text to images in your iOS app. What's jot for? Annotating Images jot is the easiest way to ad

IFTTT 1.8k Oct 28, 2022
An open source library that lets your users draw on things - mark up images with text, shapes, etc.

Drawsana 0.12.0 Drawsana is a generalized framework for making freehand drawing views on iOS. You can let users scribble over images, add shapes and t

Asana 569 Dec 23, 2022
A simple game application for iPad using SpriteKit, SKCropNode

Whack-a-Penguin A simple game application for iPad using SpriteKit, SKCropNode,

NIKOLAY NIKITIN 1 Sep 12, 2022
A super easy way to check if the installed app has an update available. It is built with simplicity and customisability in mind and comes with pre-written tests.

UpdateAvailableKit This is UpdateAvailableKit: a super easy way to check if the installed app has an update available. It is built with simplicity and

Swapnanil Dhol 22 Jan 5, 2023
Drawing and Geometry made easy on iOS - now in Swift 3.0

InkKit Swift Support Swift 4.0 InkKit is Swift 4.0 by default, so to use that just include InkKit in your podfile: pod 'InkKit' Swift 3.2 In order to

Shaps 373 Dec 27, 2022
The application is develop in Objective IOS. kids can draw whatever they want and also kids can save the drawing as well as undo erase the drawing.

IOSObjC_KidsBoard The application is develop in Objective IOS. kids can draw whatever they want and also kids can save the drawing as well as undo era

Haresh 0 Oct 28, 2021
A lightweight XMLParser for assembling and parsing XML values written for iOS 8+ in Swift 2.

Overview Description Requirements Installation Usage Author License Description XMLParser lets you convert a pure Swift dictionary into XML string and

Eugene Mozharovsky 75 Feb 2, 2022
NXDrawKit is a simple and easy but useful drawing kit for iPhone

⚠️ To use with Swift 5.0 please ensure you are using >= 0.8.0 ⚠️ ⚠️ To use with Swift 4.2 please ensure you are using >= 0.7.1 ⚠️ ⚠️ To use with Swift

Nicejinux 1.3k Dec 31, 2022
Create gradients and blur gradients without a single line of code

EZYGradientView is a different and unique take on creating gradients and gradients with blur on the iOS platform. The default CAGradientLayer implemen

Shashank Pali 380 Dec 6, 2022
When you scan the clothing tag, a 3D character appears and informs you of the clothing information.

1. Introduction When you scan the clothing tag, a 3D character appears and tells you the information on the clothes. You can select necessary informat

kimniki 0 Dec 23, 2021
3D Touch Application for Weighing Plums (and other small fruit!)

Plum-O-Meter ###3D Touch Application for Weighing Plums (and other small fruit!) Companion project to this blog post: http://flexmonkey.blogspot.co.uk

simon gladman 526 Sep 27, 2022
Visual designing library for iOS & OSX

ProcessingKit ProcessingKit is a Visual designing library for iOS & OSX. ProcessingKit written in Swift ?? and you can write like processing. Demo Dem

Atsuya Sato 333 Nov 12, 2022
Conical (angular) gradient for iOS written in Swift

AEConicalGradient Conical (angular) gradient in Swift I hope that somebody will find this useful. And nice. Usage AEConicalGradient is a minion which

Marko Tadić 82 Dec 27, 2022
🌈 Highly customizable Core Graphics based gradient view for iOS

MKGradientView Highly customizable Core Graphics based gradient view Features Available gradient types: Linear (Axial) Radial (Circular) Conical (Angu

Max Konovalov 167 Dec 27, 2022