Size2i

Objective-C


@interface Size2i : NSObject

Swift

class Size : NSObject

Represents the dimensions of a rectangle the values of which are of type int

Properties

  • Declaration

    Objective-C

    @property int width

    Swift

    var width: Int32 { get set }
  • Declaration

    Objective-C

    @property int height

    Swift

    var height: Int32 { get set }

Constructors

  • Declaration

    Objective-C

    - (instancetype)init;

    Swift

    init()
  • Declaration

    Objective-C

    - (instancetype)initWithWidth:(int)width height:(int)height;

    Swift

    init(width: Int32, height: Int32)
  • Declaration

    Objective-C

    - (instancetype)initWithPoint:(Point2i*)point;

    Swift

    init(point: Point2i)
  • Declaration

    Objective-C

    - (instancetype)initWithVals:(NSArray<NSNumber*>*)vals;

    Swift

    init(vals: [NSNumber])
  • Declaration

    Objective-C

    + (instancetype)width:(int)width height:(int)height;

    Swift

    class func width(_ width: Int32, height: Int32) -> Self

Methods

  • Returns the area of a rectangle with corresponding dimensions

    Declaration

    Objective-C

    - (double)area;

    Swift

    func area() -> Double
  • Determines if a rectangle with corresponding dimensions has area of zero

    Declaration

    Objective-C

    - (BOOL)empty;

    Swift

    func empty() -> Bool
  • Set the dimensions from the values of an array

    Declaration

    Objective-C

    - (void)set:(nonnull NSArray<NSNumber *> *)vals;

    Swift

    func set(vals: [NSNumber])

    Parameters

    vals

    The array of values from which to set the dimensions

Common Methods

  • Clone object

    Declaration

    Objective-C

    - (nonnull Size2i *)clone;

    Swift

    func clone() -> Size
  • Compare for equality

    Declaration

    Objective-C

    - (BOOL)isEqual:(nullable id)object;

    Swift

    func isEqual(_ object: Any?) -> Bool

    Parameters

    other

    Object to compare

  • Calculate hash value for this object

    Declaration

    Objective-C

    - (NSUInteger)hash;

    Swift

    func hash() -> UInt
  • Returns a string that describes the contents of the object

    Declaration

    Objective-C

    - (nonnull NSString *)description;

    Swift

    func description() -> String