SwiftUI views lock up after background and sleep for “Designed for iPad” apps

There's an easily reproducible SwiftUI bug on macOS where an app's UI state no longer updates/re-renders for "Designed for iPad" apps (i.e. ProcessInfo.processInfo.isiOSAppOnMac == true). The bug occurs in Xcode and also if the app is running independent of Xcode.

The bug occurs when:

  1. the user Hides the app (i.e. it goes into the background)
  2. the user puts the Mac to sleep (e.g. Apple menu > Sleep)
  3. a total of ~60 seconds transpires (i.e. macOS puts the app into the "suspended state")
  4. when the app is brought back into the foreground the UI no longer updates properly

The only way I have found to fix this is to manually open a new actual full app window via File > New, in which case the app works fine again in the new window.

The following extremely simple code in a default Xcode project illustrates the issue:

import SwiftUI

@main
struct staleApp: App {
  @State private var isBright = true
  var body: some Scene {
    WindowGroup() {
      ZStack {
        (isBright ? Color.white : Color.black).ignoresSafeArea()
        Button("TOGGLE") { isBright.toggle(); print("TAPPED") }
      }
      .onAppear { print("\(isBright ? "light" : "dark") view appeared") }
    }
  }
}

For the code above, after Hiding the app and putting the computer to sleep for 60 seconds or more, the button no longer swaps views, although the print statements still appear in the console upon tapping the button. Also, while in this buggy state, i can get the view to update to the current state (i.e. the view triggered by the last tap) by manually dragging the corner of the app window to resize the window. But after resizing, the view again does not update upon button tapping until I resize the window again.

so it appears the diff engine is mucked or that the Scene or WindowGroup are no longer correctly running on the main thread

I have tried rebuilding the entire view hierarchy by updating .id() on views but this approach does NOT work. I have tried many other options/hacks but have not been able to reset the 'view engine' other than opening a new window manually or by using: @Environment(.openWindow) private var openWindow

openWindow could be a viable solution except there's no way to programmatically close the old window for isiOSAppOnMac (@Environment(.dismissWindow) private var dismissWindow doesn't work for iOS)

Same issue here with a Flutter app running as "Designed for iPad" on Apple Silicon (macOS 26), so this is not specific to SwiftUI: it sits in the UIKit lifecycle layer that every framework relies on.

Reproduction (reliable for us, but not on every attempt)

  1. Run the app in a normal window (not full screen).
  2. Switch to another app that is in full screen.
  3. Lock the Mac and close the lid, wait a few minutes.
  4. Wake the Mac and go back to the app window.

What we logged

  • On lock, the app receives UIApplication.didEnterBackgroundNotification (and the scene didEnterBackground), as expected.
  • On wake, the window is visible again but no willEnterForeground / didBecomeActive is ever delivered. UIApplication.shared.applicationState stays .background (2) while the user is looking at the window and clicking in it.
  • Touch/pointer events are still delivered to the app, but because the app believes it is in the background, the renderer stays stopped, so nothing redraws.
  • Switching the window to full screen makes macOS send the foreground notifications and everything works again; going back to windowed sends didEnterBackground again and the app freezes again.

Workaround Since a click or hover can only reach a window that is visible, we treat pointer input received while applicationState == .background as proof the window is in the foreground, and, only when ProcessInfo.processInfo.isiOSAppOnMac is true, we post the notifications macOS should have sent:

NotificationCenter.default.post(name: UIApplication.willEnterForegroundNotification, object: UIApplication.shared)
NotificationCenter.default.post(name: UIApplication.didBecomeActiveNotification, object: UIApplication.shared)

This restores rendering immediately (just moving the mouse over the window is enough). applicationState itself still reports .background afterwards, so code that reads it directly is not fixed by this.

If you are affected too, please file your own feedback and reference FB25082614. Duplicates help Apple prioritise.

SwiftUI views lock up after background and sleep for “Designed for iPad” apps
 
 
Q