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