tvOS is the operating system for Apple TV.

Posts under tvOS tag

79 Posts

Post

Replies

Boosts

Views

Activity

UIHostingConfiguration on tvOS, focus engine problem with SwiftUI and collectionView
UIHostingConfiguration on tvOS: focus permanently broken with multiple focusable SwiftUI views Hi everyone, I'm working on a tvOS app with a UICollectionView. Some cells embed SwiftUI content via UIHostingConfiguration, specifically a row of 3 buttons that should be individually focusable. The cell itself returns canBecomeFocused = false so focus passes through to the SwiftUI buttons. The problem: after navigating focus into that section once, it becomes permanently unfocusable. Focus enters briefly, then immediately exits to nil on its own, without any user input. From that point on, the focus engine completely skips the section. The exact same SwiftUI view works perfectly when embedded via UIHostingController instead. How to reproduce Press DOWN to move focus into the UIHostingConfiguration section Focus lands on a SwiftUI button for a split second Focus exits on its own and bumps to another section The section is now dead, focus skips it on every subsequent navigation What the system logs say (-UIFocusLoggingEnabled YES) Right when focus enters, the system reports the SwiftUI focus items as "disappearing": Ignoring focus update request for disappearing focus environment <UIKitFocusSectionResponderItem> Then when searching for a new focusable item: <SwiftUI._UIInheritedView> → (warning) No focusable items found. <UIHostingContentView> → (warning) No focusable items found. === unable to find focused item in context. retrying with updated request. === The views are still in the hierarchy (verified by pointer), but the UIHostingContentView no longer exposes its virtual focus items. I also see mismatched parentFocusEnvironment on those items, pointing to a _UIHostingView from a completely different cell. What I've tried I've spent a lot of time on this with my colleagues, dug through the very limited documentation available online, and even used AI agents to help brainstorm. We tested 10 different approaches, none worked: Overriding preferredFocusEnvironments to point to the UIHostingContentView setNeedsFocusUpdate() / updateFocusIfNeeded(), rescan finds nothing Forcing UIKit redraws (setNeedsLayout, setNeedsDisplay) Removing .focusSection() Removing all SwiftUI animations, identical behavior Using canFocusItemAt: delegate instead of cell subclass, identical remembersLastFocusedIndexPath = true, causes a separate focus trap configurationUpdateHandler + setNeedsUpdateConfiguration(), config is rebuilt but virtual items stay deregistered Verified the UIHostingContentView never leaves the hierarchy. It doesn't, its internal state is just corrupted My workaround I switched to UIHostingController with proper view controller containment. It works because the hosting controller is a full UIFocusEnvironment, so the focus engine can traverse it and it correctly maintains its virtual items. Has anyone encountered this? Is there a known pattern for using UIHostingConfiguration on tvOS with multiple focusable SwiftUI elements? Or should I just file a Feedback? Thanks for any help! You can find the code here : https://github.com/ThomasDutartre/focus-problem-tvos I recored the problem here : https://youtu.be/yPfM5AvU2ko
0
0
41
3d
UIHostingConfiguration focus problem on tvOS, with SwiftUI view
UIHostingConfiguration on tvOS: focus permanently broken with multiple focusable SwiftUI views Hi everyone, I'm working on a tvOS app with a UICollectionView. Some cells embed SwiftUI content via UIHostingConfiguration, specifically a row of 3 buttons that should be individually focusable. The cell itself returns canBecomeFocused = false so focus passes through to the SwiftUI buttons. The problem: after navigating focus into that section once, it becomes permanently unfocusable. Focus enters briefly, then immediately exits to nil on its own, without any user input. From that point on, the focus engine completely skips the section. The exact same SwiftUI view works perfectly when embedded via UIHostingController instead. How to reproduce Press DOWN to move focus into the UIHostingConfiguration section Focus lands on a SwiftUI button for a split second Focus exits on its own and bumps to another section The section is now dead, focus skips it on every subsequent navigation What the system logs say (-UIFocusLoggingEnabled YES) Right when focus enters, the system reports the SwiftUI focus items as "disappearing": Ignoring focus update request for disappearing focus environment <UIKitFocusSectionResponderItem> Then when searching for a new focusable item: <SwiftUI._UIInheritedView> → (warning) No focusable items found. <UIHostingContentView> → (warning) No focusable items found. === unable to find focused item in context. retrying with updated request. === The views are still in the hierarchy (verified by pointer), but the UIHostingContentView no longer exposes its virtual focus items. I also see mismatched parentFocusEnvironment on those items, pointing to a _UIHostingView from a completely different cell. What I've tried I've spent a lot of time on this with my colleagues, dug through the very limited documentation available online, and even used AI agents to help brainstorm. We tested 10 different approaches, none worked: Overriding preferredFocusEnvironments to point to the UIHostingContentView setNeedsFocusUpdate() / updateFocusIfNeeded(), rescan finds nothing Forcing UIKit redraws (setNeedsLayout, setNeedsDisplay) Removing .focusSection() Removing all SwiftUI animations, identical behavior Using canFocusItemAt: delegate instead of cell subclass, identical remembersLastFocusedIndexPath = true, causes a separate focus trap configurationUpdateHandler + setNeedsUpdateConfiguration(), config is rebuilt but virtual items stay deregistered Verified the UIHostingContentView never leaves the hierarchy. It doesn't, its internal state is just corrupted My workaround I switched to UIHostingController with proper view controller containment. It works because the hosting controller is a full UIFocusEnvironment, so the focus engine can traverse it and it correctly maintains its virtual items. Has anyone encountered this? Is there a known pattern for using UIHostingConfiguration on tvOS with multiple focusable SwiftUI elements? Or should I just file a Feedback? Thanks for any help!
1
0
18
3d
Broken YouTube audio at anything other than 1x speed
Since updating to tvoS 26.1/2 YouTube audio breaks when playing videos at anything other than 1x speed. At 1.25x or higher, the audio is "static-y" and distorted almost immediately. Strangely, AirPods work fine, it only happens with other audio outputs. Anyone else experiencing this, or have a fix? tvOS: 26.2 (23J582) YouTube app: 4.51.08 Speed Output Static 1x TV speakers No 1x HomePods No 1x AirPods Pro 3 No 1.25x TV speakers Yes 1.25x HomePods Yes 1.25x HomePods Mini Yes 1.25x Sonos One Yes 1.25x AirPods Pro 3 No
1
0
197
Jan ’26
How to improve my SwiftUI tvOS app flow?
Hello, I'm thinking about how to improve my main tvOS app flow, naively I want to do something like this: import Combine import SwiftUI enum AppState { case login, onboarding, main } class AppStateManager { let appStatePublisher = PassthroughSubject<AppState, Never>() func updateState(_ appState: AppState) } struct tvOSApp: App { private var appState: AppState = .login private let appStateManager = AppStateManager() var body: some Scene { WindowGroup { ZStack { switch appState { case .login: LoginView() case .onboarding: OnboardingView() case .main: MainView() } } .onReceive(appStateManager.appStatePublisher) { self.appState = $0 } } } } So basically, MainView, OnboardingView and LoginView would be the main navigation views of my app, and the appStateManager would be a dependency passed to each of these views and allowing me to update the currently displayed view in the app. (of course I could use an Environment object instead for a 100% SwiftUI solution). I was wondering, however, if there is a better way to do this, instead of switching in a ZStack, maybe with WindowGroup/Window/Scenes? Thank you for your help!
0
0
102
Dec ’25
Buttons on tvOS with text are blurred
When adding buttons to a sheet, on tvOS the text is blurred in the buttons, making it illegible. Feedback: FB21228496 (used GPT to extract an example from my project for a test project to attach here) // ButtonBlurTestView.swift // Icarus // // Test view to reproduce blurred button issue on tvOS // import SwiftUI struct ButtonBlurTestView: View { @State private var showSheet = false @State private var selectedTags: [Int] = [] @State private var newTagName: String = "" // Hardcoded test data private let testTags = [ TestTag(id: 1, label: "Action"), TestTag(id: 2, label: "Comedy"), TestTag(id: 3, label: "Drama"), TestTag(id: 4, label: "Sci-Fi"), TestTag(id: 5, label: "Thriller") ] var body: some View { NavigationStack { VStack { Text("Button Blur Test") .font(.title) .padding() Button("Show Test Sheet") { showSheet = true } .buttonStyle(.borderedProminent) .padding() Text("Tap the button above to open a sheet with buttons inside a Form.") .font(.caption) .foregroundColor(.secondary) .multilineTextAlignment(.center) .padding() } .navigationTitle("Blur Test") .sheet(isPresented: $showSheet) { TestSheetView( selectedTags: $selectedTags, newTagName: $newTagName, testTags: testTags ) } } } } struct TestSheetView: View { @Environment(\.dismiss) private var dismiss @Binding var selectedTags: [Int] @Binding var newTagName: String let testTags: [TestTag] var body: some View { NavigationStack { VStack { // Header VStack { Text("Testing") .font(.title2) .bold() Text("Test TV Show") .font(.subheadline) .foregroundColor(.secondary) } .padding() // Form with buttons Form { Section(header: Text("Summary")) { Text("This is a test") .font(.subheadline) .foregroundColor(.secondary) } Section(header: Text("Tags")) { tagsSelectionView } } } .navigationTitle("Add") #if !os(tvOS) .navigationBarTitleDisplayMode(.inline) #endif .toolbar { ToolbarItem(placement: .cancellationAction) { Button("Cancel") { dismiss() } } ToolbarItem(placement: .confirmationAction) { Button("Add") { dismiss() } } } } } private var tagsSelectionView: some View { VStack(alignment: .leading) { // Tag pills in a grid let columns = [GridItem(.adaptive(minimum: 80), spacing: 8)] LazyVGrid(columns: columns, alignment: .leading, spacing: 8) { ForEach(testTags, id: \.id) { tag in TagPill( tag: tag, selected: selectedTags.contains(tag.id) ) { if selectedTags.contains(tag.id) { selectedTags.removeAll { $0 == tag.id } } else { selectedTags.append(tag.id) } } } } Divider() // Add new tag button HStack { TextField("New tag name", text: $newTagName) #if os(tvOS) .textFieldStyle(PlainTextFieldStyle()) #else .textFieldStyle(RoundedBorderTextFieldStyle()) #endif Button("Add") { // Test action newTagName = "" } .disabled(newTagName.trimmingCharacters(in: .whitespaces).isEmpty) } } } } // Tag Pill - matches the structure from original project private struct TagPill: View { let tag: TestTag let selected: Bool let action: () -> Void var body: some View { Button(action: action) { Text(tag.label) .font(.callout) .lineLimit(1) .padding(.horizontal, 12) .padding(.vertical, 8) .background( Capsule() .fill(selected ? Color.accentColor : Color.secondary.opacity(0.15)) ) .overlay( Capsule() .stroke(selected ? Color.accentColor : Color.secondary.opacity(0.35), lineWidth: 1) ) .foregroundStyle(selected ? Color.white : Color.primary) .contentShape(Capsule()) } .buttonStyle(.plain) #if os(tvOS) .focusable(true) #endif } } struct TestTag { let id: Int let label: String } #Preview { ButtonBlurTestView() }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
1
0
253
Dec ’25
AppleTV returns to homescreen overnight
Hi We have an AppleTV app that is used to continuously display information (digital signage). One of our clients reports that their AppleTV returns to the homescreen by morning. While our recommendation is to setup Mobile Device Management to lock the AppleTV into running only our app, not every client will have the IT knowledge to set this up. So we're trying to figure out possible causes for the app getting closed. We've not received any crash reports, nor does the device give any indication the app crashed. The energy saving settings are set to run continuously without sleep. The client is reporting this happens every night, so it seems unlikely to be caused by tvOS updates. Are there other things I could rule out to find the cause of this issue? Any ideas are welcome, thanks!
0
1
145
Dec ’25
Massive amounts of leaked memory with the tvOS 26 system player user interface
Hi, We identified massive amounts of leaked memory with the tvOS 26 standard player user interface as soon as chapters (navigation markers) are involved. Artwork images associated with chapters are not correctly released anymore, leaking memory in chunks of several MiBs. Over time apps will be terminated by the system due to excessive memory consumption. The issue was reported to Apple as tvOS 26 regression: Huge memory leaks associated with navigation marker artworks displayed in the tvOS standard user interface, filed under FB21160665.
0
0
212
Nov ’25
Skip button for tvOS with Google IMA SDK Pod
Hello, I am currently working on a tvOS project that uses the following pod: GoogleAds-IMA-tvOS-SDK (version 4.16.0). I have two specific requirements and would like clarification on their feasibility: Custom Skip Button Timing: I would like to display a custom skip button with my own skip-timer logic, instead of relying on the skippable time defined in the ad tag. Is it possible to hide the default IMA skip button and replace it with a custom one? Force-Skipping Ads: Once my custom skip button becomes available and the user chooses to skip, I need to skip the ad regardless of whether the ad itself is defined as skippable. Is there any way to force-skip an ad on tvOS using the IMA SDK? If there are any alternative approaches or recommended solutions that could help achieve these requirements, I would greatly appreciate your guidance. Thank you.
0
0
147
Nov ’25
HealthKit on macOS
HealthKit is currently not supported on macOS nor tvOS, despite being supported by visionOS. Support for macOS was last asked about[1] here in 2018. My goal is to display interactive data visualisations over workouts collected in HealthKit on macOS. Will this be possible to do in the near future using HealthKit directly? If not, can I somehow read the information from an iPhone and display it on the mac? Cheers, Rodrigo [1] https://developer.apple.com/forums/thread/94937
3
2
496
Nov ’25
tvOS 26.2 Homescreen Shadow Glitch
Hi @DTS Engineer in tvOS 26.2 Beta is still this annoying Shadow Glitch… I have submitted an Bug-Report, but dont get an Answer… FB20049524 The Animation is not smooth and the Shadow is abruptly „jumping“… I don’t get any Response from the Apple Engineers. But this GUI Glitch makes the otherwise very high-quality tvOS GUI appear very unprofessional. Could you please help me? 🤔
Topic: UI Frameworks SubTopic: General Tags:
0
0
97
Nov ’25
AVPlayer HLS High Bitrate Problem on Apple TV HD (A1625) tvOS 26
Hello, We have Video Stream app. It has HLS VOD Content. We supply 1080p, 4K Contents to users. Users were watching 1080p content before tvOS 26. Users can not watch 1080p content anymore when they update to tvOS 26. We have not changed anything at HLS playlist side and application version. This problem only occurs on Apple TV 4th Gen (A1625) tvOS 26 version. There is no problem with newer Apple TV devices. Would you help to resolve problem? Thanks in advance
2
1
552
Oct ’25
Borderless NavigationLink broken in tvOS 26
NavigationLinks do not display correctly in tvOS 26. When using a Button, the correct behavior of vertically placing an Image or AsyncImage above one or two Text fields occurs. However, when using NavigationLink the image and text(s) are laid out horizontally. Attempting to fix this using a VStack prevents the text from sliding down as the NavigationLink receives focus. Using the hoverEffect modifier does not help. Using a Button (correct behavior): Using a NavigationLink without VStack: Using a NavigationLink with VStack:
4
1
275
Oct ’25
tvOS icon missing layers
I have an AppleTV app which I released in 2016. I've updated it and released a new version every year without much hassle. This year, with tvOS 17.2, the layered app icon isn't working right. This is a two-layer image made with PNGs. When it's selected, it looks right and the layers move correctly: But when it's not selected, the background layer disappears: Screenshots are from the simulator but it also happens on the device. It's inconsistent; sometimes it's the front layer that disappears. Occasionally both layers work, but I can't tell why. I've spent a day trying everything. Very frustrated. The icon previews correctly in Xcode and in Parallax Viewer. The image sizes are correct: 400 x 240 for Small, 800 x 480 for Small@2x, 1280 x 768 for Large. The back layer is a non-transparent PNG. I tried adding a Large@2x set. Didn't help. Originally I had a three-layer image with no middle layer PNG. I deleted the empty middle layer, but that didn't help. All the PNG files are from GnuIMP. Same color space, even. I was using the filenames tvicon-back-s.png and tvicon-back-s@2x.png. I tried taking out the @ sign in case that was confusing Xcode. (It never has before, but I am flailing here.) Anybody have any clues? If it's an Apple bug and there's nothing I can do, I'm going to just push the release button and hope it fixes itself someday.
8
0
1.6k
Oct ’25
tvOS .background Colors
So I normally use the below as quick reference guide: https://mar.codes/apple-colors however, what is the reason that iOS colors are not available on tvOS? Especially the system/grays that are available on iOS. What does everyone else use for alternatives to these to get close matches between their multi platform apps?
1
0
234
Oct ’25
TV A1625 Using 3× More CPU After tvOS 26 Update
Hi everyone, After updating my Apple TV HD (model A1625) to tvOS 26, I’ve noticed a significant spike in CPU usage—up to 3× higher than before the update. Go from around 40% to 120% Model: Apple TV HD (A1625) tvOS Version: 26 (stable release) and beta version of 26.1, App downgrade stream due to lack of cpu power If anyone else is experiencing this, please share your findings or workarounds. Would love to hear from Apple engineers or other developers if this is a known regression or if there’s a recommended fix. Thanks!
4
0
258
Oct ’25
tvOS 26 - AVPlayer.preventsDisplaySleepDuringVideoPlayback not working
Hi guys, after updating to tvOS 26 it is not possible to disable screensaver using AVPlayer.preventsDisplaySleepDuringVideoPlayback. We are streaming TV programs continuously and when player is in full creen we disable screensaver by setting preventsDisplaySleepDuringVideoPlayback = true When leaving player screen and navigating to Home or EPG where player continues to play in the background we set preventsDisplaySleepDuringVideoPlayback = false to enable screen saver in which case after set time screensaver activates. Disabling screensaver appears to be working only when starting the app for the first time, but when making the first transition out of the player and calling preventsDisplaySleepDuringVideoPlayback = false for the first time, then any subsequent change of preventsDisplaySleepDuringVideoPlayback to true has no effect. Result is that player is playing in full screen, but after set period (e.g. 2 minutes) screen saver activates, which is very bad user experience making TV app unusable. I tried using Xcode 26 and targetting tvOS 17 and higher. I installed Xcode 16.4 and rebuilt the app, but I see the same problem with screensaver. Xcode 16.4 and tvOS 17 target worked before. It appears to be related to tvOS 26 not to SDK itself. Is there perhaps a new API to disable screensaver? Is preventsDisplaySleepDuringVideoPlayback obsolete or could it be intention to disallow developers disabling screensaver? Do we need to notify all users to set screensaver time to higher value or Never if they want to watch TV for all day without touching remote? Not sure if it is a bug in tvOS 26 or purposely changed behavior. Does anybody know? Thanks.
3
0
315
Oct ’25
UIScene based state restoration on tvOS not working
I can’t get UIScene-based state restoration to work on tvOS as it does on iOS. UISceneSession.stateRestorationActivity is always nil in UIWindowSceneDelegate.scene(_:willConnectTo:options:) despite UIWindowSceneDelegate.stateRestorationActivity(for:) being called in the previous lifecycle. The NSUserActivityType is correctly configured in the Info.plist. Has anyone encountered the same issue or knows how to get this to work? Sample Project https://github.com/antiraum/tvosSceneStateRestoration Feedback FB20451479
1
0
130
Sep ’25
tvOS 26 Top shelf's playbackProgress is broken
Here is a minimal code private func createItem(from movie: Movie, showProgress: Bool, imageType: ImageType) -> TVTopShelfSectionedItem { let item = TVTopShelfSectionedItem(identifier: movie.id) // Set title for the item item.title = movie.title switch imageType { case .landscape: item.imageShape = .hdtv // HDTV shape for landscape/backdrop images if let backdropUrl = movie.backdropUrl, let url = URL(string: backdropUrl) { item.setImageURL(url, for: .screenScale2x) } case .poster: item.imageShape = .poster // Poster shape for poster images if let posterUrl = movie.posterUrl, let url = URL(string: posterUrl) { item.setImageURL(url, for: .screenScale2x) } } if showProgress { item.playbackProgress = 0.5 } return item } As you can see the progress bar is pushed to the bottom. There is no padding around it. Am I doing something wrong or this is bug in the framework?
0
0
186
Sep ’25