Skip to content

Commit

Permalink
fix: Add #if os(macOS) macro
Browse files Browse the repository at this point in the history
  • Loading branch information
akring committed Mar 29, 2024
1 parent 6ab594e commit 7becb7d
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Lib/Magnet/Extensions/CollectionExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
// Copyright © 2015-2020 Clipy Project.
//

#if os(macOS)
import Foundation

public extension Collection where Element == Bool {
var trueCount: Int {
return filter { $0 }.count
}
}
#endif
2 changes: 2 additions & 0 deletions Lib/Magnet/Extensions/IntExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// Copyright © 2015-2020 Clipy Project.
//

#if os(macOS)
import Cocoa
import Carbon

Expand All @@ -22,3 +23,4 @@ public extension Int {
return NSEvent.ModifierFlags(carbonModifiers: self)
}
}
#endif
2 changes: 2 additions & 0 deletions Lib/Magnet/Extensions/KeyExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// Copyright © 2015-2020 Clipy Project.
//

#if os(macOS)
import Foundation
import Sauce

Expand Down Expand Up @@ -73,3 +74,4 @@ public extension Key {
}
}
}
#endif
2 changes: 2 additions & 0 deletions Lib/Magnet/Extensions/NSEventExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// Copyright © 2015-2020 Clipy Project.
//

#if os(macOS)
import Cocoa
import Carbon
import Sauce
Expand Down Expand Up @@ -118,3 +119,4 @@ extension NSEvent {
return KeyCombo(key: key, cocoaModifiers: self.modifierFlags)
}
}
#endif
2 changes: 2 additions & 0 deletions Lib/Magnet/HotKey.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// Copyright © 2015-2020 Clipy Project.
//

#if os(macOS)
import Cocoa
import Carbon

Expand Down Expand Up @@ -106,3 +107,4 @@ extension HotKey {
self.hotKeyRef == hotKey.hotKeyRef
}
}
#endif
2 changes: 2 additions & 0 deletions Lib/Magnet/HotKeyCenter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// Copyright © 2015-2020 Clipy Project.
//

#if os(macOS)
import Cocoa
import Carbon

Expand Down Expand Up @@ -168,3 +169,4 @@ extension HotKeyCenter {
}
}
}
#endif
2 changes: 2 additions & 0 deletions Lib/Magnet/KeyCombo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// Copyright © 2015-2020 Clipy Project.
//

#if os(macOS)
import Cocoa
import Carbon
import Sauce
Expand Down Expand Up @@ -178,3 +179,4 @@ open class KeyCombo: NSObject, NSCopying, NSCoding, Codable {
extension KeyCombo {
public struct InitializeError: Error {}
}
#endif
2 changes: 2 additions & 0 deletions Lib/Magnet/ModifierEventHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// Copyright © 2015-2020 Clipy Project.
//

#if os(macOS)
import Cocoa

open class ModifierEventHandler {
Expand Down Expand Up @@ -70,3 +71,4 @@ extension ModifierEventHandler {
}
}
}
#endif

0 comments on commit 7becb7d

Please sign in to comment.