Refactor Java to shared kotlin

This commit is contained in:
James Babcock committed 2026-09-18 22:48:20 -07:00
1 parent bc8e80c533
commit 68810197a8
173 files changed
+9855 -6252

No files matched your search

+12
View File
@@ -0,0 +1,12 @@
/** Bulk binary bridge; slices are normalized without per-byte native calls. */
export function toData(bytes: Uint8Array): NSData {
const buffer = bytes.byteOffset === 0 && bytes.byteLength === bytes.buffer.byteLength
? bytes.buffer : bytes.slice().buffer
return NSData.dataWithBytesLength(interop.handleof(buffer), bytes.byteLength)
}
export function fromData(data: NSData): Uint8Array {
return new Uint8Array(interop.bufferFromData(data)).slice()
}
export function nativeArray<T, R>(items: NSArray<T>, convert: (item: T) => R): R[] {
return Array.from({ length: items.count }, (_, i) => convert(items.objectAtIndex(i)))
}