Little fixes towards swift code formats.
This commit is contained in:
parent
63f3b3e4a0
commit
c33a9582bb
|
@ -16,7 +16,7 @@ private let kUpdateInfoSiteKey = "UpdateInfoSite"
|
|||
private let kNextCheckInterval: TimeInterval = 86400.0
|
||||
private let kTimeoutInterval: TimeInterval = 60.0
|
||||
|
||||
@objc (AppDelegate)
|
||||
@objc(AppDelegate)
|
||||
class AppDelegate: NSObject, NSApplicationDelegate,
|
||||
NonModalAlertWindowControllerDelegate {
|
||||
|
||||
|
@ -64,12 +64,12 @@ class AppDelegate: NSObject, NSApplicationDelegate,
|
|||
aboutWindowController?.window?.orderFrontRegardless() // 逼著關於視窗往最前方顯示
|
||||
}
|
||||
|
||||
@objc (checkForUpdate)
|
||||
@objc(checkForUpdate)
|
||||
func checkForUpdate() {
|
||||
checkForUpdate(forced: false)
|
||||
}
|
||||
|
||||
@objc (checkForUpdateForced:)
|
||||
@objc(checkForUpdateForced:)
|
||||
func checkForUpdate(forced: Bool) {
|
||||
|
||||
if checkTask != nil {
|
||||
|
|
|
@ -20,7 +20,7 @@ public class InputSourceHelper: NSObject {
|
|||
TISCreateInputSourceList(nil, true).takeRetainedValue() as! [TISInputSource]
|
||||
}
|
||||
|
||||
@objc (inputSourceForProperty:stringValue:)
|
||||
@objc(inputSourceForProperty:stringValue:)
|
||||
public static func inputSource(for propertyKey: CFString, stringValue: String) -> TISInputSource? {
|
||||
let stringID = CFStringGetTypeID()
|
||||
for source in allInstalledInputSources() {
|
||||
|
@ -38,12 +38,12 @@ public class InputSourceHelper: NSObject {
|
|||
return nil
|
||||
}
|
||||
|
||||
@objc (inputSourceForInputSourceID:)
|
||||
@objc(inputSourceForInputSourceID:)
|
||||
public static func inputSource(for sourceID: String) -> TISInputSource? {
|
||||
inputSource(for: kTISPropertyInputSourceID, stringValue: sourceID)
|
||||
}
|
||||
|
||||
@objc (inputSourceEnabled:)
|
||||
@objc(inputSourceEnabled:)
|
||||
public static func inputSourceEnabled(for source: TISInputSource) -> Bool {
|
||||
if let valuePts = TISGetInputSourceProperty(source, kTISPropertyInputSourceIsEnabled) {
|
||||
let value = Unmanaged<CFBoolean>.fromOpaque(valuePts).takeUnretainedValue()
|
||||
|
@ -52,13 +52,13 @@ public class InputSourceHelper: NSObject {
|
|||
return false
|
||||
}
|
||||
|
||||
@objc (enableInputSource:)
|
||||
@objc(enableInputSource:)
|
||||
public static func enable(inputSource: TISInputSource) -> Bool {
|
||||
let status = TISEnableInputSource(inputSource)
|
||||
return status == noErr
|
||||
}
|
||||
|
||||
@objc (enableAllInputModesForInputSourceBundleID:)
|
||||
@objc(enableAllInputModesForInputSourceBundleID:)
|
||||
public static func enableAllInputMode(for inputSourceBundleD: String) -> Bool {
|
||||
var enabled = false
|
||||
for source in allInstalledInputSources() {
|
||||
|
@ -79,7 +79,7 @@ public class InputSourceHelper: NSObject {
|
|||
return enabled
|
||||
}
|
||||
|
||||
@objc (enableInputMode:forInputSourceBundleID:)
|
||||
@objc(enableInputMode:forInputSourceBundleID:)
|
||||
public static func enable(inputMode modeID: String, for bundleID: String) -> Bool {
|
||||
for source in allInstalledInputSources() {
|
||||
guard let bundleIDPtr = TISGetInputSourceProperty(source, kTISPropertyBundleID),
|
||||
|
@ -100,13 +100,13 @@ public class InputSourceHelper: NSObject {
|
|||
|
||||
}
|
||||
|
||||
@objc (disableInputSource:)
|
||||
@objc(disableInputSource:)
|
||||
public static func disable(inputSource: TISInputSource) -> Bool {
|
||||
let status = TISDisableInputSource(inputSource)
|
||||
return status == noErr
|
||||
}
|
||||
|
||||
@objc (registerInputSource:)
|
||||
@objc(registerInputSource:)
|
||||
public static func registerTnputSource(at url: URL) -> Bool {
|
||||
let status = TISRegisterInputSource(url as CFURL)
|
||||
return status == noErr
|
||||
|
|
|
@ -14,7 +14,7 @@ import Cocoa
|
|||
}
|
||||
|
||||
class NonModalAlertWindowController: NSWindowController {
|
||||
@objc (sharedInstance)
|
||||
@objc(sharedInstance)
|
||||
|
||||
static let shared = NonModalAlertWindowController(windowNibName: "NonModalAlertWindowController")
|
||||
|
||||
|
|
|
@ -220,7 +220,7 @@ struct ComposingBufferSize {
|
|||
|
||||
@objc static func toogleHalfWidthPunctuationEnabled() -> Bool {
|
||||
halfWidthPunctuationEnabled = !halfWidthPunctuationEnabled
|
||||
return halfWidthPunctuationEnabled;
|
||||
return halfWidthPunctuationEnabled
|
||||
}
|
||||
|
||||
@UserDefault(key: kEscToCleanInputBufferKey, defaultValue: false)
|
||||
|
@ -306,6 +306,6 @@ struct ComposingBufferSize {
|
|||
@objc static func tooglePhraseReplacementEnabled() -> Bool {
|
||||
phraseReplacementEnabled = !phraseReplacementEnabled
|
||||
UserDefaults.standard.set(phraseReplacementEnabled, forKey: kPhraseReplacementEnabledKey)
|
||||
return phraseReplacementEnabled;
|
||||
return phraseReplacementEnabled
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ extension RangeReplaceableCollection where Element: Hashable {
|
|||
// Please note that the class should be exposed as "PreferencesWindowController"
|
||||
// in Objective-C in order to let IMK to see the same class name as
|
||||
// the "InputMethodServerPreferencesWindowControllerClass" in Info.plist.
|
||||
@objc (PreferencesWindowController) class PreferencesWindowController: NSWindowController {
|
||||
@objc(PreferencesWindowController) class PreferencesWindowController: NSWindowController {
|
||||
@IBOutlet weak var fontSizePopUpButton: NSPopUpButton!
|
||||
@IBOutlet weak var basisKeyboardLayoutButton: NSPopUpButton!
|
||||
@IBOutlet weak var selectionKeyComboBox: NSComboBox!
|
||||
|
|
|
@ -42,7 +42,7 @@ fileprivate class HorizontalCandidateView: NSView {
|
|||
return result
|
||||
}
|
||||
|
||||
@objc (setKeyLabels:displayedCandidates:)
|
||||
@objc(setKeyLabels:displayedCandidates:)
|
||||
func set(keyLabels labels: [String], displayedCandidates candidates: [String]) {
|
||||
let count = min(labels.count, candidates.count)
|
||||
keyLabels = Array(labels[0..<count])
|
||||
|
@ -60,7 +60,7 @@ fileprivate class HorizontalCandidateView: NSView {
|
|||
elementWidths = newWidths
|
||||
}
|
||||
|
||||
@objc (setKeyLabelFont:candidateFont:)
|
||||
@objc(setKeyLabelFont:candidateFont:)
|
||||
func set(keyLabelFont labelFont: NSFont, candidateFont: NSFont) {
|
||||
let paraStyle = NSMutableParagraphStyle()
|
||||
paraStyle.setParagraphStyle(NSParagraphStyle.default)
|
||||
|
@ -176,7 +176,7 @@ fileprivate class HorizontalCandidateView: NSView {
|
|||
}
|
||||
}
|
||||
|
||||
@objc (VTHorizontalCandidateController)
|
||||
@objc(VTHorizontalCandidateController)
|
||||
public class HorizontalCandidateController: CandidateController {
|
||||
private var candidateView: HorizontalCandidateView
|
||||
private var prevPageButton: NSButton
|
||||
|
|
|
@ -8,14 +8,14 @@
|
|||
|
||||
import Cocoa
|
||||
|
||||
@objc (VTCandidateControllerDelegate)
|
||||
@objc(VTCandidateControllerDelegate)
|
||||
public protocol CandidateControllerDelegate: AnyObject {
|
||||
func candidateCountForController(_ controller: CandidateController) -> UInt
|
||||
func candidateController(_ controller: CandidateController, candidateAtIndex index: UInt) -> String
|
||||
func candidateController(_ controller: CandidateController, didSelectCandidateAtIndex index: UInt)
|
||||
}
|
||||
|
||||
@objc (VTCandidateController)
|
||||
@objc(VTCandidateController)
|
||||
public class CandidateController: NSWindowController {
|
||||
@objc public weak var delegate: CandidateControllerDelegate?
|
||||
@objc public var selectedCandidateIndex: UInt = UInt.max
|
||||
|
@ -69,7 +69,7 @@ public class CandidateController: NSWindowController {
|
|||
UInt.max
|
||||
}
|
||||
|
||||
@objc (setWindowTopLeftPoint:bottomOutOfScreenAdjustmentHeight:)
|
||||
@objc(setWindowTopLeftPoint:bottomOutOfScreenAdjustmentHeight:)
|
||||
public func set(windowTopLeftPoint: NSPoint, bottomOutOfScreenAdjustmentHeight height: CGFloat) {
|
||||
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now()) {
|
||||
self.doSet(windowTopLeftPoint: windowTopLeftPoint, bottomOutOfScreenAdjustmentHeight: height)
|
||||
|
|
|
@ -71,7 +71,7 @@ private let kCandidateTextLeftMargin:CGFloat = 8.0
|
|||
|
||||
|
||||
|
||||
@objc (VTVerticalCandidateController)
|
||||
@objc(VTVerticalCandidateController)
|
||||
public class VerticalCandidateController: CandidateController {
|
||||
private var keyLabelStripView: VerticalKeyLabelStripView
|
||||
private var scrollView: NSScrollView
|
||||
|
|
Loading…
Reference in New Issue