Please see trivial example of above issue with NavigationSplitView not working on smaller iPhones. Works as expected on iPads and iPhone Pro max, but the detail view does not appear on SE, Xr... and smaller iPhones. Should see a simple parabola on the detail view and the text "This is the sidebar view" in the sidebar. When you run the code, the detail view will appear first on the large iPhones. When you run the code on smaller iPhones, only the sidebar will appear. Thank for taking a look.
//
// ContentView.swift
// Trivial plot
//
// Created on 8/09/23.
//
import SwiftUI
import Charts
let xData = [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10]
let yData = [100,81,64,49,36,25,16,9,4,1,0,1,4,9,16,25,36,49,64,81,100]
struct ContentView: View {
var body: some View {
NavigationSplitView {
ScrollView {
Text("This is the sidebar view.")
} /* End ScrollView */
} /* End NavigationSplitView */
//************************** Detail view here *********************************************
detail: {
Chart(0..<xData.count, id: \.self) { index in
LineMark(
x: .value("", xData[index]),
y: .value("", yData[index])
)
}
.foregroundStyle(Color(.sRGB, red: 0.999424, green: 0.985554, blue: 0))
.chartYScale( domain: .automatic(includesZero: false, reversed: false), type: .linear )
.chartXScale( domain: .automatic(includesZero: false, reversed: false) )
.chartXAxis { AxisMarks(values: .automatic(desiredCount: 10)) }
} /* End detail: */
} /* End of Body: Some View */
} /* End of Struct ContentView */