CGPoint

extension CGPoint
  • Returns the Manhattan or city-block distance between two points.

    Declaration

    Swift

    static func manhattanDistance(from first: CGPoint, to second: CGPoint) -> CGFloat

    Parameters

    first

    The starting CGPoint

    second

    The destination CGPoint

    Return Value

    A CGFloat rerpesenting the Manhattan distance between the two points.

  • Returns the Manhattan or city-block distance between two points.

    Declaration

    Swift

    func manhattanDistance(to point: CGPoint) -> CGFloat

    Parameters

    point

    The destination CGPoint from itself.

    Return Value

    A CGFloat rerpesenting the Manhattan distance between the two points.