Skip to content

Commit

Permalink
Add #if os(macOS) macro (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
akring authored Mar 30, 2024
1 parent 42e4361 commit 9014ffe
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Lib/Sauce/InputSource.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 Carbon

Expand Down Expand Up @@ -56,3 +57,4 @@ extension InputSource: Equatable {
lhs.modeID == rhs.modeID
}
}
#endif
2 changes: 2 additions & 0 deletions Lib/Sauce/Key.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 Carbon

Expand Down Expand Up @@ -561,3 +562,4 @@ public enum Key: String, Codable, Equatable, Sendable {
}

}
#endif
2 changes: 2 additions & 0 deletions Lib/Sauce/KeyboardLayout.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 Carbon

Expand Down Expand Up @@ -186,3 +187,4 @@ private extension KeyboardLayout {
return NSString(characters: &chars, length: length) as String
}
}
#endif
2 changes: 2 additions & 0 deletions Lib/Sauce/ModifierTransformer.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 Carbon
import AppKit
Expand Down Expand Up @@ -44,3 +45,4 @@ extension ModifierTransformer {
return convertedCarbonModifiers
}
}
#endif
2 changes: 2 additions & 0 deletions Lib/Sauce/NSMenuItem+Key.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 AppKit

extension NSMenuItem {
Expand All @@ -21,3 +22,4 @@ extension NSMenuItem {
return Key(character: keyEquivalent, virtualKeyCode: nil)
}
}
#endif
2 changes: 2 additions & 0 deletions Lib/Sauce/Sauce.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 AppKit

Expand Down Expand Up @@ -112,3 +113,4 @@ extension Sauce {
return character(with: source, keyCode: keyCode, carbonModifiers: modifierTransformar.carbonFlags(from: cocoaModifiers))
}
}
#endif
2 changes: 2 additions & 0 deletions Lib/Sauce/SpecialKeyCode.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 Carbon

Expand Down Expand Up @@ -157,3 +158,4 @@ private extension Int {
return String(format: "%C", self)
}
}
#endif
2 changes: 2 additions & 0 deletions Lib/Sauce/TISInputSource+Property.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 Carbon

Expand All @@ -17,3 +18,4 @@ extension TISInputSource {
return Unmanaged<AnyObject>.fromOpaque(value).takeUnretainedValue() as? T
}
}
#endif

0 comments on commit 9014ffe

Please sign in to comment.