Size

public struct Size: Equatable, Comparable, CustomStringConvertible

A structure that contains width and height values. Values stored as Double, otherwise synonymous with CGSize.

  • The width of the size.

    Declaration

    Swift

    public var width: Double
  • The height of the size.

    Declaration

    Swift

    public var height: Double
  • Initializes a new Size with the dimensions {0,0}

    let s = Size()
    

    Declaration

    Swift

    public init()
  • Initializes a new Size with the dimensions {width,height}

    let s = Size(5.2,5.2)
    

    Declaration

    Swift

    public init(_ width: Double, _ height: Double)
  • Initializes a new Size with the dimensions {width,height}, converting Int values to Double

    let s = Size(5,5)
    

    Declaration

    Swift

    public init(_ width: Int, _ height: Int)
  • Initializes a new Size from a CGSize.

    Declaration

    Swift

    public init(_ size: CGSize)
  • Returns true if the dimensions of the receiver are {0,0}

    let s = Size()
    s.isZero() //-> true
    

    Declaration

    Swift

    public func isZero() -> Bool
  • A string representation of the size.

    Declaration

    Swift

    public var description: String

    Return Value

    A string formatted to look like {w,h}