Skip to content

Instantly share code, notes, and snippets.

@fjolnir
Created July 4, 2014 07:55
Show Gist options
  • Save fjolnir/22e579575799574b6616 to your computer and use it in GitHub Desktop.
Save fjolnir/22e579575799574b6616 to your computer and use it in GitHub Desktop.
NSMapTable *attributes;
for(id path in PSVGPathsFromSVGString(svg, &attributes)) {
CAShapeLayer *layer = [CAShapeLayer layer];
layer.path = (__bridge CGPathRef)path;
NSDictionary *attrs = [attributes objectForKey:path];
layer.strokeColor = (__bridge CGColorRef)attrs[@"strokeColor"];
layer.lineWidth = [attrs[@"strokeWidth"] floatValue];
layer.fillColor = (__bridge CGColorRef)attrs[@"fillColor"];
[self.view.layer addSublayer:layer];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment