Files
OSGKeyboard/OSGKeyboardShared/Utilities/HanScript.swift
T
Rocky 9f308fadd2 feat(keyboard): ship AI hint carousel, home library cards, and clipboard polish
Rotate AI idle suggestions with optional remote packs, move history/dictionary onto self-sizing Home preview cards, harden clipboard capture/prompting, and simplify keyboard chrome by dropping most liquid-glass shadows.
2026-08-13 01:00:51 +08:00

20 lines
507 B
Swift

// HanScript.swift
// OSGKeyboard · Shared
//
// Canonical BMP Han ideograph predicate used by text-processing features.
enum HanScript {
static func isIdeograph(_ scalar: Unicode.Scalar) -> Bool {
switch scalar.value {
case 0x3400...0x4DBF, 0x4E00...0x9FFF, 0xF900...0xFAFF:
return true
default:
return false
}
}
static func containsIdeograph(in text: String) -> Bool {
text.unicodeScalars.contains(where: isIdeograph)
}
}