Thanks for being a part of WWDC25!

How did we do? We’d love to know your thoughts on this year’s conference. Take the survey here

tvOS: Using .onExitCommand to Navigate to Home Tab Before Exiting — Is This Acceptable?

Hi Apple Developer Team,

In my tvOS app built with SwiftUI, I have a tab-based interface with several sections. The first tab (index 0) is the Home tab. Other tabs include Contact, WiFi, Welcome, etc.

I want to handle the remote's Menu / Back button (.onExitCommand) so that:

If the user is on any tab other than Home (tabs 1, 2, 3, etc.), pressing the Menu button takes them back to the Home tab.

If the user is already on the Home tab, then pressing the TV/Home button (not Menu) behaves as expected — suspending or exiting the app (handled by the system, no code involved).

Here's a simplified version of what I implemented:

.onExitCommand {
    if selectedTab != 0 {
        selectedTab = 0
        focusedTab = 0
    } else {
        // Let system handle the exit when user presses the TV/Home button
    }
}

This behavior ensures users don’t accidentally exit the app when they're browsing other tabs, and provides a consistent navigation experience.

Question: Is this an acceptable and App Store-compliant use of .onExitCommand on tvOS?

I'm not calling exit(0) or trying to force-terminate the app — just using .onExitCommand for in-app navigation purposes.

Any official guidance or best practices would be greatly appreciated!

Thanks, Prashant

tvOS: Using .onExitCommand to Navigate to Home Tab Before Exiting — Is This Acceptable?
 
 
Q