SwiftUI macOS 14: NavigationSplitView isn't displayed well for right to left languages

51 Views Asked by At

Feedback ID: FB13480093

I have the following basic NavigationSplitView on macOS 14, that's taken from this question:

fileprivate struct Item: Identifiable, Hashable {
    let id = UUID()
}

fileprivate let items = (0...10).map { _ in Item() }

struct ContentView: View {
    @State var selectedItem: UUID?

    var body: some View {
        NavigationSplitView {
            
            List(selection: $selectedItem) {
                
                Section {
                    ForEach(items) { item in
                        Text(item.id.uuidString)
                            .tag(item.id)
                    }
                } header: {
                    Text("Navigable rows")
                }
            }
            .navigationTitle("Navigation Title Jump")
            
        } detail: {
            if let selectedItem,
                 let item = items.first(where: { $0.id == selectedItem }) {
                
                Text(item.id.uuidString)
                    .navigationTitle("Detail View")
                
            } else {
                Text("No selection")
            }
        }
    }
}

When I apply the following modifiers on the ContentView:

.environment(\.locale, Locale(identifier: "ar"))
.environment(\.layoutDirection, .rightToLeft)

to let the app appears right-to-left for Arabic language, the split view side bar's navigation bar becomes the navigationTitle's holder for all views of the side bar items's detail views, i.e. when I select an item in the side bar list, and this item has a corresponding view with a navigation title, this title appears on the side bar instead of appearing on the detail panel's navigation bar.

Another issue is that the side bar hide/show button appears on the navigation bar of the detail panel instead of appearing above the side bar as appears in the following screenshot:

enter image description here

any workarounds are appreciated.

0

There are 0 best solutions below