Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make iOS and iPadOS Xcode previews work for multiplatform apps #153

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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