SVGParser

public protocol SVGParser

A protocol describing an XML parser capable of parsing SVG data

  • Initializer to create a new SVGParser instance

    Declaration

    Swift

    init(svgData: Data, supportedElements: SVGParserSupportedElements?, completion: ((SVGLayer) -> ())?)

    Parameters

    SVGData

    SVG file as Data

    supportedElements

    The elements and corresponding attribiutes the parser can parse

    completion

    A closure to execute after the parser has completed parsing and processing the SVG

  • A closure that is executed after all elements have been processed. Should be guaranteed to be executed after all elements have been processed, even if parsing asynchronously.

    Declaration

    Swift

    var completionBlock: ((SVGLayer) -> ())? { get }
  • A struct listing all the elements and its attributes that should be parsed

    Declaration

    Swift

    var supportedElements: SVGParserSupportedElements? { get }
  • A CALayer that will house the finished sublayers of the SVG doc.

    Declaration

    Swift

    var containerLayer: SVGLayer { get }
  • Starts parsing the SVG. Allows you to separate initialization from parse start in case you want to set some things up first.

    Declaration

    Swift

    func startParsing()