Things I found out:
In your UIWindowSceneDelegate use:
@available(iOS 26.0, *)
func preferredWindowingControlStyle(for windowScene: UIWindowScene) -> UIWindowScene.WindowingControlStyle {
return .minimal
}
This way the window controls will move closer to the top and the safe area is adjusted so your button should move to below the window controls.
If you don't want that the safe area is adjusted (which will result in more white space at the top), you can use .unified instead of .minimal. In UIKit you can then use a layout guide to place a view below the window controls:
let contentGuide = self.view.layoutGuide(for: .margins(cornerAdaptation: .vertical))
childView.topAnchor.constraint(equalTo: contentGuide.topAnchor).isActive = true
You can also use .horizontal and .leftAnchor to place the view to the right of the window controls.
I don't know how to do this in SwiftUI.
Topic:
UI Frameworks
SubTopic:
UIKit
Tags: