IntVector
Objective-C
@interface IntVector : NSObject
Swift
class IntVector : NSObject
Utility class to wrap a std::vector<int>
-
Create IntVector and initialize with the contents of an NSData object
Declaration
Objective-C
- (nonnull instancetype)initWithData:(nonnull NSData *)data;
Swift
init(data: Data)
Parameters
data
NSData containing raw int array
-
Create IntVector and initialize with the contents of another IntVector object
Declaration
Objective-C
- (nonnull instancetype)initWithVector:(nonnull IntVector *)src;
Swift
init(vector src: IntVector)
Parameters
src
IntVector containing data to copy
-
Create IntVector from raw C array
Declaration
Objective-C
- (nonnull instancetype)initWithNativeArray:(nonnull int *)array elements:(NSInteger)elements;
Swift
init(nativeArray array: UnsafeMutablePointer<Int32>, elements: Int)
Parameters
array
The raw C array @elements elements The number of elements in the array
-
Length of the vector
Declaration
Objective-C
@property (readonly) NSInteger length;
Swift
var length: Int { get }
-
Raw C array
Declaration
Objective-C
@property (readonly) int *_Nonnull nativeArray;
Swift
var nativeArray: UnsafeMutablePointer<Int32> { get }
-
NSData object containing the raw int data
Declaration
Objective-C
@property (readonly) NSData *_Nonnull data;
Swift
var data: Data { get }
-
Return array element
Declaration
Objective-C
- (int)get:(NSInteger)index;
Swift
func get(_ index: Int) -> Int32
Parameters
index
Index of the array element to return