GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - SVGKit/SVGKit: Display and interact with SVG Images on iOS / OS X, using native rendering (CoreAnimation)

BranchesTags
Open more actions menu

Latest commit

 

History

886 Commits
886 Commits

Folders and files

NameName
Last commit message
Last commit date
3rd-party-frameworks/CocoaLumberjack-2.2.0
3rd-party-frameworks/CocoaLumberjack-2.2.0
 
 
Demo-OSX.xcodeproj
Demo-OSX.xcodeproj
 
 
Demo-Samples
Demo-Samples
 
 
Demo-iOS.xcodeproj
Demo-iOS.xcodeproj
 
 
SVGKit-iOS.xcodeproj
SVGKit-iOS.xcodeproj
 
 
SVGKitFrameworks
SVGKitFrameworks
 
 
SVGKitLibrary
SVGKitLibrary
 
 
Source
Source
 
 
.gitignore
.gitignore
 
 
.travis.yml
.travis.yml
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
Cartfile
Cartfile
 
 
Cartfile.resolved
Cartfile.resolved
 
 
ISSUE_TEMPLATE
ISSUE_TEMPLATE
 
 
LICENSE
LICENSE
 
 
Package.swift
Package.swift
 
 
README.mdown
README.mdown
 
 
SVGKit.podspec
SVGKit.podspec
 
 

Repository files navigation

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
  5. Use Swift Package Manager

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.

OPTION 5: Using Swift Package Manager

In XCode go to File -> Add Packages... and provide URL to this repository in the search bar. Choose Dependency Role and select apropriate project.

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:

  • GETTING STARTED, plus NEW FEATURES: http://t-machine.org/index.php/2012/12/31/svgkit-2013-usage/

  • QUICK RECIPES for common uses:  http://t-machine.org/index.php/2013/01/02/svgkit-2013-recipes/

    • additiona: How to scale an SVG image on screen: http://t-machine.org/index.php/2013/04/14/svgkit-scaling-svg-images/
  • 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

About

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

Resources

Readme
License

Contributing

Contributing
Activity
Custom properties

Stars

4.6k stars

Watchers

113 watching

Forks

1.1k forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.