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 pathDeclaration
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 methodDefault implementation for any
PathCommand
indicating where there are enough coordinates stored to be able to process theSVGElement
Declaration
Swift
var canPushCommand: Bool { get }
-
clearBuffer()
Extension methodFunction that clears the current number buffer
Declaration
Swift
mutating func clearBuffer()
-
pushCoordinate(_:)
Extension methodAdds a new coordinate to the buffer
Declaration
Swift
mutating func pushCoordinate(_ coordinate: Double)
-
pointForPathType(_:relativeTo:)
Extension methodBased on the
PathType
of this PathCommand, this function returns the relative or absolute pointDeclaration
Swift
func pointForPathType(_ point: CGPoint, relativeTo: CGPoint) -> CGPoint