Skip to content

Add tvOS platform support - #77

Open
om-mani-padme-hum wants to merge 1 commit into
colinc86:mainfrom
om-mani-padme-hum:tvos-support
Open

om-mani-padme-hum wants to merge 1 commit into
colinc86:mainfrom
om-mani-padme-hum:tvos-support

Conversation

@om-mani-padme-hum

Copy link
Copy Markdown

Summary

Adds tvOS platform support to LaTeXSwiftUI, based on the v1.3.2 release.

  • Adds .tvOS(.v16) to Package.swift platforms
  • Adds || os(tvOS) to all #if os(iOS) conditional compilation checks across 7 source files (Aliases, Renderer, Image+Extensions, ImageRenderer+Extensions, Font+Extensions, SVGGeometry)
  • Fixes Font+Extensions: returns .title1 instead of .largeTitle on tvOS (UIFont.TextStyle.largeTitle is unavailable on tvOS)

Rationale

tvOS uses UIKit, so all existing iOS code paths (UIImage, UIFont, UIColor, ImageRenderer) apply directly with no behavioral changes needed. The rendering pipeline (MathJax via JavaScriptCore → SVG → ImageRenderer) works on tvOS since it does not depend on WKWebView.

All three dependencies work on tvOS:

  • MathJaxSwift — uses JavaScriptCore (available on tvOS)
  • SVGView — compiles for tvOS (needs .tvOS added to its Package.swift platforms separately)
  • swift-html-entities — no platform restrictions

Note on SVGView

SVGView 1.0.6 does not declare tvOS in its Package.swift platforms. A companion PR to exyte/SVGView adding .tvOS(.v16) is recommended. Without it, SPM will still compile SVGView for tvOS but TapGesture usage requires the consuming app to set a tvOS deployment target ≥ 16.0.

Test plan

  • Build for tvOS Simulator (Apple TV) — verified with Xcode 26.4
  • Verify LaTeX rendering in a tvOS app (chemical formulas, math equations, Greek letters, fractions)
  • Verify iOS and macOS builds are unaffected

🤖 Generated with Claude Code

- Add .tvOS(.v16) to Package.swift platforms
- Add || os(tvOS) to all #if os(iOS) conditional compilation checks
  (Aliases, Renderer, Image+Extensions, ImageRenderer+Extensions,
   Font+Extensions, SVGGeometry)
- Fix Font+Extensions: return .title1 instead of .largeTitle on tvOS
  (UIFont.TextStyle.largeTitle is unavailable on tvOS)

tvOS uses UIKit like iOS, so all existing iOS code paths apply directly.
All three dependencies already work on tvOS:
- MathJaxSwift 3.4.0: uses JavaScriptCore (not WKWebView)
- SVGView 1.0.6: needs .tvOS platform in its Package.swift (separate PR)
- swift-html-entities 4.0.1: no platform restrictions

Note: SVGView 1.0.6 does not declare tvOS in its Package.swift platforms.
A companion PR to exyte/SVGView is needed to add .tvOS(.v16). Without it,
SPM will still compile SVGView for tvOS but TapGesture usage may require
the consuming app to set a tvOS deployment target >= 16.0.
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