Anchor2D
public struct Anchor2D : Hashable
Represents a point in a rectangle as a ratio of this rectangle’s width and height.
-
Defines the x axis where the left is 0, the right is 1 and the middle is 0.5. The default value is 0.5.
Declaration
Swift
public var horizontal: Double -
Defines the y axis where the top is 0, the bottom is 1 and the middle is 0.5. The default value is 0.5.
Declaration
Swift
public var vertical: Double -
Creates a new instance of an Anchor2D with the default parameters
Declaration
Swift
public init() -
Creates a new instance of an Anchor2D.
Declaration
Swift
public init(horizontal: Double, vertical: Double)Parameters
horizontalDefines the x axis where the left is 0, the right is 1 and the middle is 0.5.
verticalDefines the y axis where the top is 0, the bottom is 1 and the middle is 0.5.
-
Returns an anchor positioned at the center.
Declaration
Swift
public static func center() -> Anchor2DReturn Value
An Anchor2D at (0.5, 0.5).
-
Returns an anchor positioned at the top center.
Declaration
Swift
public static func top() -> Anchor2DReturn Value
An Anchor2D at (0.5, 0.0).
-
Returns an anchor positioned at the top right.
Declaration
Swift
public static func topRight() -> Anchor2DReturn Value
An Anchor2D at (1.0, 0.0).
-
Returns an anchor positioned at the right center.
Declaration
Swift
public static func right() -> Anchor2DReturn Value
An Anchor2D at (1.0, 0.5).
-
Returns an anchor positioned at the bottom right.
Declaration
Swift
public static func bottomRight() -> Anchor2DReturn Value
An Anchor2D at (1.0, 1.0).
-
Returns an anchor positioned at the bottom center.
Declaration
Swift
public static func bottom() -> Anchor2DReturn Value
An Anchor2D at (0.5, 1.0).
-
Returns an anchor positioned at the bottom left.
Declaration
Swift
public static func bottomLeft() -> Anchor2DReturn Value
An Anchor2D at (0.0, 1.0).
-
Returns an anchor positioned at the left center.
Declaration
Swift
public static func left() -> Anchor2DReturn Value
An Anchor2D at (0.0, 0.5).
-
Returns an anchor positioned at the top left.
Declaration
Swift
public static func topLeft() -> Anchor2DReturn Value
An Anchor2D at (0.0, 0.0).