Skip to content

Fix Mac Catalyst build by gating AppKit code on os(macOS)#25

Open
TizianoCoroneo wants to merge 1 commit into
LiYanan2004:mainfrom
TizianoCoroneo:tiziano/fix-mac-catalyst
Open

Fix Mac Catalyst build by gating AppKit code on os(macOS)#25
TizianoCoroneo wants to merge 1 commit into
LiYanan2004:mainfrom
TizianoCoroneo:tiziano/fix-mac-catalyst

Conversation

@TizianoCoroneo

Copy link
Copy Markdown

Mac Catalyst reports both os(iOS) and canImport(AppKit) as true, so the mismatched conditionals collided: PlatformTypes.swift selected the UIKit family (os()-based) while ~8 other files selected the AppKit branch (canImport(AppKit)-based), calling AppKit-only APIs on UIKit types and, for the paired +AppKit/+UIKit files and InlineHostingAttachment's twin #if blocks, compiling both branches at once into duplicate declarations.

Fixes:

  • Replace every #if canImport(AppKit) with #if os(macOS) so the whole codebase gates on one axis: macOS => AppKit, everything else (incl. Catalyst) => UIKit. UIKit/#else branches are unchanged.
  • Add a Build workflow that compiles the package for macOS, iOS, and Mac Catalyst so the fix stays green.

Mac Catalyst reports both os(iOS) and canImport(AppKit) as true, so the
mismatched conditionals collided: PlatformTypes.swift selected the UIKit
family (os()-based) while ~8 other files selected the AppKit branch
(canImport(AppKit)-based), calling AppKit-only APIs on UIKit types and, for
the paired +AppKit/+UIKit files and InlineHostingAttachment's twin #if blocks,
compiling both branches at once into duplicate declarations.

Replace every `#if canImport(AppKit)` with `#if os(macOS)` so the whole
codebase gates on one axis: macOS => AppKit, everything else (incl. Catalyst)
=> UIKit. UIKit/#else branches are unchanged.

Add a Build workflow that compiles the package for macOS, iOS, and Mac
Catalyst so the fix stays green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant