FloatVector
Objective-C
@interface FloatVector : NSObject
Swift
class FloatVector : NSObject
Utility class to wrap a std::vector<float>
-
Create FloatVector 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 float array
-
Create FloatVector and initialize with the contents of another FloatVector object
Declaration
Objective-C
- (nonnull instancetype)initWithVector:(nonnull FloatVector *)src;
Swift
init(vector src: FloatVector)
Parameters
src
FloatVector containing data to copy
-
Create FloatVector from raw C array
Declaration
Objective-C
- (nonnull instancetype)initWithNativeArray:(nonnull float *)array elements:(NSInteger)elements;
Swift
init(nativeArray array: UnsafeMutablePointer<Float>, 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) float *_Nonnull nativeArray;
Swift
var nativeArray: UnsafeMutablePointer<Float> { get }
-
NSData object containing the raw float data
Declaration
Objective-C
@property (readonly) NSData *_Nonnull data;
Swift
var data: Data { get }
-
Return array element
Declaration
Objective-C
- (float)get:(NSInteger)index;
Swift
func get(_ index: Int) -> Float
Parameters
index
Index of the array element to return