Skip to content

fix(visionOS): make the package actually build for visionOS#80

Open
gabhelstudios-dev wants to merge 2 commits into
colinc86:mainfrom
gabhelstudios:fix/visionos-cocoa-import
Open

fix(visionOS): make the package actually build for visionOS#80
gabhelstudios-dev wants to merge 2 commits into
colinc86:mainfrom
gabhelstudios:fix/visionos-cocoa-import

Conversation

@gabhelstudios-dev

@gabhelstudios-dev gabhelstudios-dev commented May 10, 2026

Copy link
Copy Markdown

Summary

Two small fixes that were keeping LaTeXSwiftUI from building on visionOS, even though the package declares .visionOS(.v1) in Package.swift.

1. Previews/LaTeX_Previews+Fonts.swift — missing os(visionOS) in the iOS guard

Every other #if os(...) guard in the package already includes visionOS (Aliases.swift, Renderer.swift, Font+Extensions.swift, Image+Extensions.swift, LaTeX.swift, SVGGeometry.swift). This preview file was missed, so visionOS fell through to import Cocoa and the build failed with:

Unable to resolve module dependency: 'Cocoa'

2. Package.swift — bump visionOS minimum to 2.0

EquationMarker (and its call site in Component.swift) conform to / use TextAttribute and customAttribute(_:), both of which are iOS 18 / macOS 15 / visionOS 2.0+. The existing @available(iOS 18.0, macOS 15.0, *) lets * expand to the package's visionOS deployment target, which was .v1. Result:

'EquationMarker' is only available in visionOS 2.0 or newer

visionOS 1 has been superseded by visionOS 2 for over a year, and the package already uses visionOS 2 era APIs (TextAttribute), so bumping the floor to .visionOS(.v2) matches the real API surface.

Alternative: add visionOS 2.0 explicitly to the two @available annotations and keep .visionOS(.v1) in Package.swift. Happy to switch to that form if you'd rather preserve visionOS 1 support.

Test plan

  • Built downstream visionOS app target (deployment 26.0) — both errors gone, package compiles cleanly.
  • No source changes affect iOS/macOS/etc. behavior.

The other Apple-platform guards across the package already use
`#if os(iOS) || os(visionOS)` so visionOS picks up `UIKit` instead of
falling through to `Cocoa`. This preview file was missed when
visionOS support was added, so building any visionOS target that
links LaTeXSwiftUI fails with `Unable to resolve module dependency: 'Cocoa'`.
`EquationMarker` and the `customAttribute(_:)` call site in `Component.swift`
require `TextAttribute`, which is iOS 18 / macOS 15 / visionOS 2.0+. Their
`@available(iOS 18.0, macOS 15.0, *)` annotations let `*` expand to the
package's visionOS deployment target, which was `.v1` (1.0) — so the
package fails to build for visionOS with:

  'EquationMarker' is only available in visionOS 2.0 or newer

visionOS 1 has been deprecated for over a year and the rest of the package's
visionOS guards already assume modern visionOS. Bumping the minimum to 2.0
matches the actual API surface used.
@gabhelstudios-dev gabhelstudios-dev changed the title fix(visionOS): include visionOS in iOS guard for LaTeX_Previews+Fonts fix(visionOS): make the package actually build for visionOS May 10, 2026
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.

2 participants