title: How can I get a CGPathRef from SVGkit? or better solution to create CGPaths for CAKeyframeAnimation?
body: <p>I'm basically in need of a way to graphically create paths for import into my app, so that I can use them in CAKeyframeAnimation objects as the animation path. I'm also sort of short on time to roll my own separate tool to do this at the moment. So I thought SVGkit might be the fastest / easiest way around it. </p>
  
  <p>But I'm now having trouble correctly adding the different subpaths that make up the whole path.</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>So far, I have this:</p>
  
  <pre><code>  // l has already been setup and added to the main view layer:
    // it's the CALayer whose position I'm trying to animate over the path.
  
  
    SVGDocument *document = [SVGDocument documentNamed:@"pathtest.svg"];
    CALayer *f = [document layerTree];
  
    CGMutablePathRef path = CGPathCreateMutable();
    for(int i = 0; i &lt; [f.sublayers count]; i++)
      CGPathAddPath(path, NULL, ((CAShapeLayer*)[f.sublayers objectAtIndex:i]).path);
  
  
    CAKeyframeAnimation *a = [CAKeyframeAnimation animationWithKeyPath:@"position"];
    a.path = path;
    a.fillMode = kCAFillModeForwards;
    a.removedOnCompletion = NO;
    a.duration = 5.0;
    [l addAnimation:a forKey:nil];
  </code></pre>
  
  <p>The above code is 'almost' right (but not quite, funny): the different subpaths making up my path are added to the main path. But subpaths seem to not be added at the end of the previous subpaths. That is, when running the animation, the CALayer seems to translate through one segment of the path, then jump to a different location from which it starts smoothly translating along the second subpath,etc.. for all subpaths making up the main path. </p>
  
  <p>Any ideas?</p>