hex/ios/HEXShared/KeyboardCore.swift
Sebastian Herrlinger f106060a7f iOS: KeyboardCore.swift sits in HEXShared, as dev filled FullKeyboard's 60 files
dev added two files to ios/HEXShared/FullKeyboard (#2392, #2365), so the
core's Swift handle there made 61, over code-shape's folder limit. It moves
up beside KeyboardBridge.swift; both targets compile all of HEXShared.
2026-11-22 20:20:32 +01:00

20 lines
635 B
Swift

import Foundation
import HexKeyboardCore
/// A typing model opened by the keyboard's Rust core (`crates/keyboard`, `hk_model_*`): its
/// own read-only map of the file. It never changes once open, so any thread may use it.
nonisolated final class KeyboardCoreModel: @unchecked Sendable {
/// The core's handle, for the other wrappers of its interface.
let pointer: OpaquePointer
init?(url: URL) {
guard let pointer = hk_model_open(url.path) else { return nil }
self.pointer = pointer
}
deinit {
hk_model_free(pointer)
}
var wordCount: Int { Int(hk_model_word_count(pointer)) }
}