Int4

Objective-C

@interface Int4 : NSObject

Swift

class Int4 : NSObject

Simple wrapper for a vector of four int

Properties

  • v0

    First vector element

    Declaration

    Objective-C

    @property int v0;

    Swift

    var v0: Int32 { get set }
  • v1

    Second vector element

    Declaration

    Objective-C

    @property int v1;

    Swift

    var v1: Int32 { get set }
  • v2

    Third vector element

    Declaration

    Objective-C

    @property int v2;

    Swift

    var v2: Int32 { get set }
  • v3

    Fourth vector element

    Declaration

    Objective-C

    @property int v3;

    Swift

    var v3: Int32 { get set }

Constructors

  • Create zero-initialize vecior

    Declaration

    Objective-C

    - (nonnull instancetype)init;

    Swift

    init()
  • Create vector with specified element values

    Declaration

    Objective-C

    - (nonnull instancetype)initWithV0:(int)v0 v1:(int)v1 v2:(int)v2 v3:(int)v3;

    Swift

    init(v0: Int32, v1: Int32, v2: Int32, v3: Int32)

    Parameters

    v0

    First element

    v1

    Second element

    v2

    Third element

    v3

    Fourth element

  • Create vector with specified element values

    Declaration

    Objective-C

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

    Swift

    init(vals: [NSNumber])

    Parameters

    vals

    array of element values

  • Update vector with specified element values

    Declaration

    Objective-C

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

    Swift

    func set(vals: [NSNumber])

    Parameters

    vals

    array of element values

  • Get vector as an array

    Declaration

    Objective-C

    - (nonnull NSArray<NSNumber *> *)get;

    Swift

    func get() -> [NSNumber]

Common Methods

  • Compare for equality

    Declaration

    Objective-C

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

    Swift

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

    Parameters

    other

    Object to compare