PathCommand

internal protocol PathCommand : PreviousCommand

A protocol that describes an instance that can process an individual SVG Element

  • An array that stores processed coordinates values

    Declaration

    Swift

    var coordinateBuffer: [Double] { get set }
  • The minimum number of coordinates needed to process the path command

    Declaration

    Swift

    var numberOfRequiredParameters: Int { get }
  • The path type, relative or absolute

    Declaration

    Swift

    var pathType: PathType { get }
  • Designated initializer that creates a relative or absolute PathCommand

    Declaration

    Swift

    init(pathType: PathType)
  • Once the numberOfRequiredParameters has been met, this method will append new path to the passed path

    Declaration

    Swift

    func execute(on path: UIBezierPath, previousCommand: PreviousCommand?)

    Parameters

    path

    The path to append a new path to

    previousCommand

    An optional previous command. Used primarily with the shortcut cubic and quadratic Bezier types

  • canPushCommand Extension method

    Default implementation for any PathCommand indicating where there are enough coordinates stored to be able to process the SVGElement

    Declaration

    Swift

    var canPushCommand: Bool { get }
  • clearBuffer() Extension method

    Function that clears the current number buffer

    Declaration

    Swift

    mutating func clearBuffer()
  • pushCoordinate(_:) Extension method

    Adds a new coordinate to the buffer

    Declaration

    Swift

    mutating func pushCoordinate(_ coordinate: Double)
  • Based on the PathType of this PathCommand, this function returns the relative or absolute point

    Declaration

    Swift

    func pointForPathType(_ point: CGPoint, relativeTo: CGPoint) -> CGPoint