@@ -22,7 +22,8 @@ public protocol RecordViewDelegate: class {
22
22
func recordViewDidEndRecording( _ recordView: RecordView )
23
23
}
24
24
25
- @IBDesignable open class RecordView : NSView {
25
+ @IBDesignable
26
+ open class RecordView : NSView {
26
27
27
28
// MARK: - Properties
28
29
@IBInspectable open var backgroundColor : NSColor = . white {
@@ -306,14 +307,14 @@ public protocol RecordViewDelegate: class {
306
307
307
308
// Clean Flag
308
309
let delay = 0.3 * Double( NSEC_PER_SEC)
309
- let time = DispatchTime . now ( ) + Double( Int64 ( delay) ) / Double( NSEC_PER_SEC)
310
+ let time = DispatchTime . now ( ) + Double( Int64 ( delay) ) / Double( NSEC_PER_SEC)
310
311
DispatchQueue . main. asyncAfter ( deadline: time, execute: { [ weak self] in
311
312
self ? . doubleTapModifier = NSEvent . ModifierFlags ( rawValue: 0 )
312
313
} )
313
314
} else {
314
315
inputModifiers = NSEvent . ModifierFlags ( rawValue: 0 )
315
316
}
316
-
317
+
317
318
super. flagsChanged ( with: theEvent)
318
319
}
319
320
@@ -350,14 +351,14 @@ extension RecordView {
350
351
}
351
352
352
353
// MARK: - Recording
353
- extension RecordView {
354
- public func beginRecording( ) -> Bool {
354
+ public extension RecordView {
355
+ func beginRecording( ) -> Bool {
355
356
if !isEnabled { return false }
356
357
if isRecording { return true }
357
358
358
359
needsDisplay = true
359
360
360
- if let delegate = delegate , !delegate. recordViewShouldBeginRecording ( self ) {
361
+ if let delegate = delegate, !delegate. recordViewShouldBeginRecording ( self ) {
361
362
NSSound . beep ( )
362
363
return false
363
364
}
@@ -371,7 +372,7 @@ extension RecordView {
371
372
return true
372
373
}
373
374
374
- public func endRecording( ) {
375
+ func endRecording( ) {
375
376
if !isRecording { return }
376
377
377
378
inputModifiers = NSEvent . ModifierFlags ( rawValue: 0 )
@@ -391,40 +392,40 @@ extension RecordView {
391
392
}
392
393
393
394
// MARK: - Clear Keys
394
- extension RecordView {
395
- public func clear( ) {
395
+ public extension RecordView {
396
+ func clear( ) {
396
397
keyCombo = nil
397
398
inputModifiers = NSEvent . ModifierFlags ( rawValue: 0 )
398
399
needsDisplay = true
399
400
didChange ? ( nil )
400
401
delegate? . recordViewDidClearShortcut ( self )
401
402
}
402
403
403
- @objc public func clearAndEndRecording( ) {
404
+ @objc func clearAndEndRecording( ) {
404
405
clear ( )
405
406
endRecording ( )
406
407
}
407
408
}
408
409
409
410
// MARK: - Modifiers
410
- extension RecordView {
411
- fileprivate func validateModifiers( _ modifiers: NSEvent . ModifierFlags ? ) -> Bool {
411
+ private extension RecordView {
412
+ func validateModifiers( _ modifiers: NSEvent . ModifierFlags ? ) -> Bool {
412
413
guard let modifiers = modifiers else { return false }
413
414
return KeyTransformer . carbonFlags ( from: modifiers) != 0
414
415
}
415
416
}
416
417
417
418
// MARK: - Bool Extension
418
- extension Bool {
419
- fileprivate var intValue : Int {
419
+ private extension Bool {
420
+ var intValue : Int {
420
421
return NSNumber ( value: self ) . intValue
421
422
}
422
423
}
423
424
424
425
// MARK: - NSColor Extensio
425
426
// nmacOS 10.14 polyfill
426
- extension NSColor {
427
- fileprivate static let controlAccentPolyfill : NSColor = {
427
+ private extension NSColor {
428
+ static let controlAccentPolyfill : NSColor = {
428
429
if #available( macOS 10 . 14 , * ) {
429
430
return NSColor . controlAccentColor
430
431
} else {
0 commit comments