Animated SVG in UIView

I need to play different animated SVG files in a UIView. For example, this .

Is it possible, and can someone tell me how to do this?

Update

With PocketSVG I try this (thanks @Dhanashree):

- (void)viewDidLoad
{
    [super viewDidLoad];
    CGPathRef myPath = [PocketSVG pathFromSVGFileAtURL:[NSURL URLWithString:@"http://www.hypnobeast.com/spirals/Hypno_Beast_Spiral_1000x1000.svg"]];

    CAShapeLayer *myShapeLayer = [CAShapeLayer layer];
    myShapeLayer.path = myPath;
    [self.view.layer addSublayer:myShapeLayer];   
}

But that will not work. Animated part of SVG is not displayed.

+4
source share
1 answer

PocketSVG allows you to display and manipulate the lines of an SVG file.

PocketSVG *myBezier = [[PocketSVG alloc] initFromSVGFileNamed:@"BezierCurve1-iPad"];    
UIBezierPath *myPath = myBezier.bezier;

CAShapeLayer *myShapeLayer = [CAShapeLayer layer];
myShapeLayer.path = myPath.CGPath;

[self.view.layer addSublayer:myShapeLayer];
+1
source

Source: https://habr.com/ru/post/1533143/


All Articles