Coder Social home page Coder Social logo

veryfun / svgkit Goto Github PK

View Code? Open in Web Editor NEW

This project forked from svgkit/svgkit

0.0 2.0 0.0 24.04 MB

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

Home Page: (currently only supported for iOS - OS X code needs updating)

License: Other

CSS 0.08% HTML 4.28% JavaScript 0.01% Objective-C 94.11% Ruby 0.16% C 0.83% C++ 0.06% Swift 0.48%

svgkit's Introduction

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

  • v2.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

NB: April 2015: new Demo app, many more features, may have teething troubles with this one.

  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.

Build the static library (automatic)

We use this build script to automatically build ALL versions of the library at once, and ship 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", 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.

However, early versions of Xcode5 have a major bug, affecting all libraries:

  1. Xcode 5: Apple will create a hardlink to your local hard-disk, breaking your project for all your co-workers. This is a new bug added for Xcode5 :(
  2. Xcode5: in Build Settings, scroll down to the "Library Search Paths"
  3. Xcode5: double click it. If it has any absolute paths, chop off the start, and replace the start with ""$(SRCROOT)/"" (note the quotes inside are necessary - Apple's Xcode has another bug where it will fail to build if you have spaces in any of your folder names!)

Instead of fixing the bug, in latest Xcode 5.0.2, Apple has simply made it allow two copies of every Search Path. Hmm.

Recipes for using the library

Here are some posts on using SVGKit, with advice on which methods to use and why:

I get a crash with "unrecognized selector" ?

If you get this error:

"+[NSCharacterSet SVGWhitespaceCharacterSet]: unrecognized selector sent to class "

... you're probably building the Static Library, but forgot to do the step below:

"Edit your build settings and add "Other Linker Flags" = "-ObjC""

Usage - OS X

We need someone to integrate the OS X fork into the main project - please help.

The fork is over here: https://github.com/MaddTheSane/SVGKit/tree/master

svgkit's People

Contributors

adamgit avatar couloirr avatar dgileadi avatar greghe avatar seltzered avatar stich avatar tsaizhenling avatar xlc avatar rhcad avatar maddthesane avatar notjosh avatar sweetmandm avatar dblandin avatar meric avatar requilence avatar stephenhouser avatar arcrain avatar newmaniese avatar mattrajca avatar martinmreed avatar badpirate avatar buscarini avatar qwzybug avatar freeatnet avatar pyro2927 avatar andmar1x avatar samskiter avatar rrbrambley avatar flemingm avatar joeldev avatar

Watchers

James Cloos avatar 翊榕 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.