TISExtension // Add notes regarding "scriptCode".

This commit is contained in:
ShikiSuen 2022-10-16 17:01:55 +08:00
parent 98487ce974
commit 2e58eca255
1 changed files with 2 additions and 0 deletions

View File

@ -114,6 +114,8 @@ extension TISInputSource {
} }
public var scriptCode: Int { public var scriptCode: Int {
// Shiki's note: There is no "kTISPropertyScriptCode" in TextInputSources.h file.
// Using Mzp's latest solution in his blog: https://mzp.hatenablog.com/entry/2018/07/16/212026
let r = TISGetInputSourceProperty(self, "TSMInputSourcePropertyScriptCode" as CFString) let r = TISGetInputSourceProperty(self, "TSMInputSourcePropertyScriptCode" as CFString)
return unsafeBitCast(r, to: NSString.self).integerValue return unsafeBitCast(r, to: NSString.self).integerValue
} }