Skip to content

Commit

Permalink
Make iOS and iPadOS previews for multiplatform apps work
Browse files Browse the repository at this point in the history
  • Loading branch information
seungwoochoe committed Nov 19, 2023
1 parent 731615a commit 7c42852
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Sources/KeyboardShortcuts/CarbonKeyboardShortcuts.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if os(macOS)
import Carbon.HIToolbox

private func carbonKeyboardShortcutsEventHandler(eventHandlerCall: EventHandlerCallRef?, event: EventRef?, userData: UnsafeMutableRawPointer?) -> OSStatus {
Expand Down Expand Up @@ -345,3 +346,4 @@ extension CarbonKeyboardShortcuts {
}
}
}
#endif
2 changes: 2 additions & 0 deletions Sources/KeyboardShortcuts/Key.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if os(macOS)
import Carbon.HIToolbox

extension KeyboardShortcuts {
Expand Down Expand Up @@ -192,3 +193,4 @@ extension KeyboardShortcuts.Key {
*/
var isFunctionKey: Bool { Self.functionKeys.contains(self) }
}
#endif
2 changes: 2 additions & 0 deletions Sources/KeyboardShortcuts/KeyboardShortcuts.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if os(macOS)
import AppKit.NSMenu

/**
Expand Down Expand Up @@ -589,3 +590,4 @@ extension KeyboardShortcuts {
extension Notification.Name {
static let shortcutByNameDidChange = Self("KeyboardShortcuts_shortcutByNameDidChange")
}
#endif
2 changes: 2 additions & 0 deletions Sources/KeyboardShortcuts/NSMenuItem++.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if os(macOS)
import AppKit

extension NSMenuItem {
Expand Down Expand Up @@ -107,3 +108,4 @@ extension NSMenuItem {
}
}
}
#endif
2 changes: 2 additions & 0 deletions Sources/KeyboardShortcuts/Name.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if os(macOS)
extension KeyboardShortcuts {
/**
The strongly-typed name of the keyboard shortcut.
Expand Down Expand Up @@ -56,3 +57,4 @@ extension KeyboardShortcuts.Name: RawRepresentable {
self.init(rawValue)
}
}
#endif
2 changes: 2 additions & 0 deletions Sources/KeyboardShortcuts/Recorder.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if os(macOS)
import SwiftUI

@available(macOS 10.15, *)
Expand Down Expand Up @@ -164,3 +165,4 @@ extension KeyboardShortcuts.Recorder {
KeyboardShortcuts.Recorder(for: .init("xcodePreview"))
.environment(\.locale, .init(identifier: "ru"))
}
#endif
2 changes: 2 additions & 0 deletions Sources/KeyboardShortcuts/RecorderCocoa.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if os(macOS)
import AppKit
import Carbon.HIToolbox

Expand Down Expand Up @@ -323,3 +324,4 @@ extension KeyboardShortcuts {
}
}
}
#endif
2 changes: 2 additions & 0 deletions Sources/KeyboardShortcuts/Shortcut.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if os(macOS)
import AppKit
import Carbon.HIToolbox

Expand Down Expand Up @@ -324,3 +325,4 @@ extension KeyboardShortcuts.Shortcut: CustomStringConvertible {
modifiers.description + (keyToCharacter()?.capitalized ?? "")
}
}
#endif
2 changes: 2 additions & 0 deletions Sources/KeyboardShortcuts/Utilities.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if os(macOS)
import Carbon.HIToolbox
import SwiftUI

Expand Down Expand Up @@ -470,3 +471,4 @@ extension View {
.alignmentGuide(.leading) { $0[.controlAlignment] }
}
}
#endif
2 changes: 2 additions & 0 deletions Sources/KeyboardShortcuts/ViewModifiers.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if os(macOS)
import SwiftUI

@available(macOS 12, *)
Expand Down Expand Up @@ -38,3 +39,4 @@ extension View {
}
}
}
#endif

0 comments on commit 7c42852

Please sign in to comment.