Repo // Remove NSObject(Protocol) wherever it's safe to remove.

This commit is contained in:
ShikiSuen 2022-05-16 23:50:51 +08:00
parent 461f94fec4
commit 2c23ba3a11
7 changed files with 17 additions and 20 deletions

View File

@ -57,10 +57,10 @@ import Cocoa
/// create a new user phrase.
/// - Choosing Candidate: The candidate window is open to let the user to choose
/// one among the candidates.
class InputState: NSObject {
class InputState {
/// Represents that the input controller is deactivated.
class Deactivated: InputState {
override var description: String {
var description: String {
"<InputState.Deactivated>"
}
}
@ -73,7 +73,7 @@ class InputState: NSObject {
""
}
override var description: String {
var description: String {
"<InputState.Empty>"
}
}
@ -86,7 +86,7 @@ class InputState: NSObject {
""
}
override var description: String {
var description: String {
"<InputState.EmptyIgnoringPreviousState>"
}
}
@ -102,7 +102,7 @@ class InputState: NSObject {
self.poppedText = poppedText
}
override var description: String {
var description: String {
"<InputState.Committing poppedText:\(poppedText)>"
}
}
@ -119,7 +119,7 @@ class InputState: NSObject {
self.cursorIndex = cursorIndex
}
override var description: String {
var description: String {
"<InputState.NotEmpty, composingBuffer:\(composingBuffer), cursorIndex:\(cursorIndex)>"
}
}
@ -398,7 +398,7 @@ class InputState: NSObject {
super.init()
}
override var description: String {
var description: String {
"<InputState.AssociatedPhrases, candidates:\(candidates), useVerticalMode:\(useVerticalMode)>"
}
}
@ -421,20 +421,18 @@ class InputState: NSObject {
}
}
class SymbolNode: NSObject {
class SymbolNode {
var title: String
var children: [SymbolNode]?
init(_ title: String, _ children: [SymbolNode]? = nil) {
self.title = title
self.children = children
super.init()
}
init(_ title: String, symbols: String) {
self.title = title
children = Array(symbols).map { SymbolNode(String($0), nil) }
super.init()
}
static let catCommonSymbols = String(

View File

@ -34,7 +34,7 @@ public enum InputMode: String {
// MARK: - Delegate.
protocol KeyHandlerDelegate: NSObjectProtocol {
protocol KeyHandlerDelegate {
func ctlCandidate(for _: KeyHandler) -> Any
func keyHandler(
_: KeyHandler, didSelectCandidateAt index: Int,
@ -46,7 +46,7 @@ protocol KeyHandlerDelegate: NSObjectProtocol {
// MARK: - Kernel.
class KeyHandler: NSObject {
class KeyHandler {
let kEpsilon: Double = 0.000001
var _composer: Tekkon.Composer = .init()
var _inputMode: String = ""
@ -55,7 +55,7 @@ class KeyHandler: NSObject {
var _builder: Megrez.BlockReadingBuilder
var _walkedNodes: [Megrez.NodeAnchor] = []
weak var delegate: KeyHandlerDelegate?
var delegate: KeyHandlerDelegate?
var inputMode: InputMode {
get {
@ -71,9 +71,8 @@ class KeyHandler: NSObject {
set { setInputMode(newValue.rawValue) }
}
override init() {
public init() {
_builder = Megrez.BlockReadingBuilder(lm: _languageModel)
super.init()
ensureParser()
setInputMode(ctlInputMethod.currentInputMode)
}

View File

@ -30,7 +30,7 @@ extension String {
}
}
class vChewingKanjiConverter: NSObject {
class vChewingKanjiConverter {
class func cnvTradToKangXi(_ strObj: String) -> String {
var strObj = strObj
strObj.selfReplace("", "")

View File

@ -30,7 +30,7 @@ public protocol FSEventStreamHelperDelegate: AnyObject {
func helper(_ helper: FSEventStreamHelper, didReceive events: [FSEventStreamHelper.Event])
}
public class FSEventStreamHelper: NSObject {
public class FSEventStreamHelper {
public struct Event {
var path: String
var flags: FSEventStreamEventFlags

View File

@ -28,7 +28,7 @@ import Cocoa
// The namespace of this input method.
public enum vChewing {}
public class IME: NSObject {
public class IME {
static let arrSupportedLocales = ["en", "zh-Hant", "zh-Hans", "ja"]
static let dlgOpenPath = NSOpenPanel()

View File

@ -215,7 +215,7 @@ struct ComposingBufferSize {
// MARK: -
public class mgrPrefs: NSObject {
public class mgrPrefs {
static var allKeys: [String] {
[
UserDef.kIsDebugModeEnabled,

View File

@ -36,7 +36,7 @@ private var gLangModelCHT = vChewing.LMInstantiator()
private var gUserOverrideModelCHS = vChewing.LMUserOverride()
private var gUserOverrideModelCHT = vChewing.LMUserOverride()
class mgrLangModel: NSObject {
class mgrLangModel {
/// fileprivate
public static var lmCHS: vChewing.LMInstantiator { gLangModelCHS }
public static var lmCHT: vChewing.LMInstantiator { gLangModelCHT }