mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2025-01-29 10:19:27 +01:00
31 lines
489 B
Plaintext
Executable File
31 lines
489 B
Plaintext
Executable File
class SomeViewController: NSViewController {
|
|
|
|
@IBOutlet weak var textField: NSTextField
|
|
private var NSTimer: fetchDataTimer?
|
|
private var currentText: String? {
|
|
didSet {
|
|
invalidateTimer()
|
|
if currentText.length > 3 {
|
|
restartTimer()
|
|
}
|
|
}
|
|
}
|
|
|
|
func textDidChange(notification: NSNotification) {
|
|
|
|
currentText = textField.stringValue
|
|
}
|
|
|
|
func invalidateTimer() {
|
|
|
|
if let timer = timer {
|
|
if timer.isValid {
|
|
timer.invalidate()
|
|
}
|
|
self.timer = nil
|
|
}
|
|
}
|
|
|
|
|
|
|
|
} |