Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load an svg file and render it onto a UIView #72

Closed
KarimFikani opened this issue Dec 1, 2016 · 6 comments
Closed

Load an svg file and render it onto a UIView #72

KarimFikani opened this issue Dec 1, 2016 · 6 comments
Assignees
Milestone

Comments

@KarimFikani
Copy link

KarimFikani commented Dec 1, 2016

Is it possible with Macaw to load an svg file and render it onto a UIView? Something similar to https://github.com/pocketsvg/PocketSVG

@shipinev
Copy link
Member

shipinev commented Dec 2, 2016

Hi @KarimFikani!

With latest master updates you can render SVG by using SVGView.
You need to specify that with your pod declaration:

pod 'Macaw', :git => 'https://github.com/exyte/Macaw.git'

If you have any further questions, please don't hesitate to ask.

@shipinev shipinev closed this as completed Dec 2, 2016
@KarimFikani
Copy link
Author

Thank you @shipinev for your reply. Actually I meant if svg files can be loaded dynamically into a uiview through code and not by dragging and dropping it to a uiview. If yes, can you provide me with a code sample that does that? I looked at the examples repository that you have and couldn't find anything related to loading from files. Thanks.

@shipinev
Copy link
Member

shipinev commented Dec 2, 2016

Yep, of course. You need to create programatically SVGView with needed frame and set fileName attribute which automatically calls rendering proccess of your SVG file:

let svgView = SVGView(frame: CGRect(x: 0, y: 0, width: 200, height: 200))
svgView.fileName = "svgFileName"

@KarimFikani
Copy link
Author

KarimFikani commented Dec 7, 2016

So I loaded the following svg file
rabbit.svg.zip

and got the following:

simulator screen shot dec 6 2016 7 14 45 pm

The eyes are missing the black ellipse.

@shipinev
Copy link
Member

shipinev commented Dec 7, 2016

I have fixed this issue, please try to render your SVG file now.

simulator screen shot 7 dec 2016 12 58 28

@KarimFikani
Copy link
Author

it works thanks!

@zapletnev zapletnev added this to the 0.8.0 milestone Dec 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants