Skip to content

feat(examples): Apple TV target for the SwiftUI demo - #2

Draft
shaaaaawn wants to merge 1 commit into
feat/tvos-realitykit-sdkfrom
feat/tvos-demo
Draft

shaaaaawn wants to merge 1 commit into
feat/tvos-realitykit-sdkfrom
feat/tvos-demo

Conversation

@shaaaaawn

@shaaaaawn shaaaaawn commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Summary

The SwiftUI demo in mobile/examples/ios_swiftui is the package's only runnable host, and it is iOS-only. Building on the tvOS RealityKit layer (feat(ios): compile the RealityKit layer on tvOS 26), this PR adds an Apple TV target that compiles the demo's preset scenes on device and explores them with the Siri Remote. Apple TV has no touch input, so the camera and selection come from the remote.

Controls

Siri Remote Action
Swipe on the touch surface Orbit the camera
Clickpad ring / arrows Step the camera 15°
Select Run onSelect on the node under a center reticle
Play/Pause Reset the camera
Menu Back to the scene list; from there, leave the app

Design

  • TVContentView.swift drives the camera with XROrbitCameraState, as the iOS demo does, and Select calls XRLiveRealityKitSession.handleTap(at:in:) at the reticle, so onSelect behaviors run as they do on iOS.
  • Remote buttons are tap recognizers on the focused ARView, so Menu is consumed only while exploring and the app never traps the user.
  • The iOS and tvOS targets share one XcodeGen target template. The iOS app is unchanged: the shared Swift files add || os(tvOS) to their platform gates, and the app entry point shows TVContentView on tvOS.
  • The TV app keeps the default ThreeLiveCapabilities policy (scripts only): its bundled scenes need no network, storage, sensor or AI capability.

Docs

The demo README gains an Apple TV section (build, controls, UI test command); .gitignore gains the generated InfoTV.plist.

Testing

a773f55 plus the tvOS RealityKit commit and this commit, Xcode 27.2, Swift 6.4.2:

  • xcodegen generate, then the iOS and tvOS demos build with no new warnings.
  • xcodebuild test -scheme ThreeLiveDemoTV on tvOS 26.5 and tvOS 27.0 simulators: 3/3 pass on each. ThreeLiveDemoTVUITests drives the app with the simulated Siri Remote (XCUIRemote):
    • Explore → Select (miss) → Menu returns to the scene list without leaving the app.
    • Instanced Lattice → Select hits LatticeEnergyCore.
    • Menu on the scene list leaves the app.

Apple TV 4K simulator, tvOS 27.0:

Scene list: CAD Gears compiled on device in 330 ms Explore: Select hits LatticeEnergyCore Orbited with the remote
Scene list with CAD Gears selected and its compile time Explore mode: HUD reads Selected LatticeEnergyCore, reticle on the knot Instanced Lattice after orbiting the camera with the remote

Orbit clip (4 s):

tvos-orbit.mp4

Not covered: swipe feel on a physical Siri Remote (XCUIRemote cannot swipe). CI is unchanged; the UI tests need a tvOS simulator and run locally with the command in the demo README. The demo runs only its bundled preset scripts: no network input, accounts or persistence.

@shaaaaawn
shaaaaawn force-pushed the feat/tvos-realitykit-sdk branch from d78122e to 8908e86 Compare November 15, 2026 06:52
@shaaaaawn
shaaaaawn force-pushed the feat/tvos-realitykit-sdk branch from 8908e86 to 4afdc22 Compare November 15, 2026 16:30
@shaaaaawn
shaaaaawn force-pushed the feat/tvos-realitykit-sdk branch from 4afdc22 to ae6b7d9 Compare November 15, 2026 23:03
@shaaaaawn
shaaaaawn force-pushed the feat/tvos-realitykit-sdk branch from ae6b7d9 to 6b23d61 Compare November 17, 2026 03:09
@shaaaaawn
shaaaaawn force-pushed the feat/tvos-realitykit-sdk branch from 6b23d61 to 2a846f1 Compare November 17, 2026 03:48
@shaaaaawn
shaaaaawn force-pushed the feat/tvos-realitykit-sdk branch from 2a846f1 to 5e10c9b Compare November 17, 2026 05:07
@shaaaaawn
shaaaaawn force-pushed the feat/tvos-demo branch 2 times, most recently from 65d4d78 to f0cace0 Compare November 17, 2026 05:42
@shaaaaawn
shaaaaawn force-pushed the feat/tvos-realitykit-sdk branch from 5e10c9b to a3a317b Compare November 17, 2026 05:57
Add ThreeLiveDemoTV (tvOS 26+), which compiles the demo's preset scenes
on device and explores them with the Siri Remote: swipe on the touch
surface to orbit, click the clickpad ring or arrows to step 15 degrees,
Select runs onSelect on the node under a center reticle, Play/Pause
resets the camera, and Menu returns to the scene list (and, from there,
leaves the app as tvOS expects).

The camera reuses the iOS demo's XROrbitCameraState, and Select calls
XRLiveRealityKitSession.handleTap(at:in:) at the reticle, so onSelect
behaviors run as they do on iOS. Remote buttons are tap recognizers on
the focused ARView, so Menu is consumed only while exploring. The iOS
and tvOS apps share one XcodeGen target template, and the iOS app's
behavior is unchanged.

ThreeLiveDemoTVUITests drives the app with XCUIRemote: Explore, Select
(miss) and Menu stay in the app; Select on Instanced Lattice hits
LatticeEnergyCore; Menu on the scene list leaves the app. CI is
unchanged. Swiping on a physical Siri Remote is not covered (XCUIRemote
cannot swipe).
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