Repository navigation
Conversation
shaaaaawn
force-pushed
the
feat/tvos-realitykit-sdk
branch
5 times, most recently
from
November 17, 2026 03:48
6b23d61 to
2a846f1
Compare
The package declares tvOS 15 and ships tvOS XCFramework slices, but on tvOS only ThreeCompiler is built: every RealityKit file is behind `canImport(RealityKit) && !os(tvOS)`. tvOS 26 (Xcode 26) ships RealityKit, so compile the existing layer there, with tvOS as one more platform rather than a special path: - RealityKitHelper, XRLiveRealityKitSession, XRSpatialRealityKitFeatures and XRSimRealityKitBridge build on tvOS with Swift 6.2+ and are available from tvOS 26.0. The package keeps its tvOS 15 floor; with older Xcode the layer is compiled out as before. - tvOS lacks two legacy APIs. The existing call sites are unchanged; the tvOS variant sits in the `#else` of the code that needs it: loadEntityWithoutBlocking (never reached on tvOS, which always has the async Entity initializer) and makeTexture, now shared by the splat and contact-shadow textures (TextureResource(image:options:) instead of generate(from:options:)). - applyOutline asks a small cullFrontFaces helper whether front-face culling is available, so tvOS builds without an unreachable-code warning. - configureStudioEnvironment(of:) and handleTap(at:in:) also cover tvOS's ARView, so a tvOS host selects with the same call as iOS (for example at a center reticle). Post-processing stays iOS-only. The existing RealityKit tests now also run on tvOS (skipping below tvOS 26), including the session outline test, plus new tests for the outline shell and for makeTexture (raw textures read back byte for byte, color textures keep alpha). 120 tests pass on the macOS host and on iOS 26.5, tvOS 26.5, tvOS 27.0 and visionOS 27.2 simulators.
shaaaaawn
force-pushed
the
feat/tvos-realitykit-sdk
branch
from
November 17, 2026 05:07
2a846f1 to
5e10c9b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Apple TV has no WebKit, so native rendering is the only way to show three-live scenes there.
ThreeLiveCompileralready declares tvOS 15 and ships tvOS XCFramework slices, but on tvOS only the compiler builds: every RealityKit file sits behind#if canImport(RealityKit) && !os(tvOS). tvOS 26 ships RealityKit, so this PR enables the RealityKit layer on tvOS 26+ whileThreeCompiler-only apps keep the tvOS 15 floor.A follow-up PR adds an Apple TV target to the SwiftUI example (Siri Remote orbit and select).
API
RealityKitHelper,XRLiveRealityKitSession,XRSpatialRealityKitFeaturesandXRSimRealityKitBridgecompile on tvOS with Swift 6.2+ and are@available(tvOS 26.0, *). With Xcode < 26 the layer is compiled out, as today.configureStudioEnvironment(of:)andhandleTap(at:in:)also cover tvOS'sARView, so a tvOS host selects with the same call as iOS (e.g. at a center reticle). Post-processing stays iOS-only.Platform differences
Existing call sites are unchanged; the two RealityKit APIs tvOS lacks are handled in the
#elseof the code that needs them.loadEntityWithoutBlocking, the fallback for OSes without theasyncEntityinitializer, uses that initializer on tvOS (never reached there; tvOS 26 always has it).makeTexture(rgba:size:semantic:), now shared by the splat and contact-shadow textures, usesTextureResource(image:options:)on tvOS instead ofgenerate(from:options:).applyOutlineasks a smallcullFrontFaceshelper whether front-face culling is available, which keeps its hover fallback without an unreachable-code warning on tvOS.Docs and security
mobile/ios/README.md: the platform table, the tvOS requirements, and a tvOS line in the tap-handling snippet (also inXRLiveRealityKitSession's doc comment).ThreeLiveCapabilitieschecks from feat(security): enforce fail-closed capability-based security across Web, Android, iOS, and CLI google/three-live#103.Testing
a773f55plus this commit, Xcode 27.2, Swift 6.4.2:swift test(macOS) andxcodebuild test -scheme ThreeLiveCompiler-Packageon iOS 26.5, tvOS 26.5, tvOS 27.0 and Apple Vision Pro (visionOS 27.2) simulators: 120 tests pass on each (118 inThreeLiveCompilerTests, 2 inThreeLiveKernelsTests), none skipped. New coverage on tvOS includes:testWorkbenchAndBallpitLoadInRealityKitand the outline test from fix(ios): render outline traits in XRLiveRealityKitSession google/three-live#102, whose guard now names tvOS 26testOutlineAddsFrontFaceCulledShellAndRemovesIt, andtestMakeTextureKeepsRawBytesAndColorAlpha(raw textures read back through Metal byte for byte; color textures keep alpha)swift-format lintreports nothing new.handleTap(at:in:)on tvOS 27.0: the follow-up's Siri Remote UI test selectsLatticeEnergyCorethrough it.makeTexturebyte-identical tomain's code on iOS, macOS and visionOS, and tvOS'sTextureResource(image:)gives the same bytes.TextureResource(image:)path). The tvOS half is from that follow-up's Apple TV app.Not covered: physical Apple TV hardware, and splat textures on screen (no preset uses splats; the texture test and parity check above cover that path).