siteline / swiftui-introspect

Introspect underlying UIKit/AppKit components from SwiftUI
MIT License
5.68k stars 352 forks source link

displayModeButtonVisibility in introspectSplitViewController not working properly in iOS 17 #372

Closed danielmeridaforch closed 1 year ago

danielmeridaforch commented 1 year ago

Description

I'm using .displayModeButtonVisibility = .never in a NavigationSplitView that controls my app. However, after updating to iOS 17 (iPadOS 17, to be more concrete) it hides the button at first sight, but when I choose a different NavigationSplitView's selection the button is visible.

Checklist

Expected behavior

No response

Actual behavior

No response

Steps to reproduce

No response

Version information

No response

Destination operating system

No response

Xcode version information

No response

Swift Compiler version information

No response

davdroman commented 1 year ago

Here's the fix:

.introspect(.navigationSplitView, on: .iOS(.v16, .v17)) { splitViewController in
    DispatchQueue.main.async {
        splitViewController.displayModeButtonVisibility = .never
    }
}
danielmeridaforch commented 1 year ago

Thank you so much! It works perfectly now.