iOS16.5.1の人はiPhoneで、以下をコピペするとわかります。
下のバーがなぜか起動時に本来の位置より上にあり、すぐに元の位置に戻ります。
この現象は
ToolbarItem(placement: .bottomBar) {
ToolbarItemGroup(placement: .bottomBar) {
どちらでも起こります。
早く治してクレメンス
import SwiftUI
import CoreData
struct ContentView: View {
@State var selected:Int? = 1
@State var selected2:Int?
var body: some View {
NavigationSplitView {
List(selection: $selected){
NavigationLink(value: 1){
Text("A")
}
NavigationLink(value: 2){
Text("B")
}
NavigationLink(value: 3){
Text("C")
}
}
} content: {
if let selected = selected {
Text(String(selected))
List(selection: $selected2){
ForEach(0..<10000){index in
NavigationLink(value: index){
Text(index.description)
}
}
}
.toolbar {
ToolbarItemGroup(placement: .bottomBar) {
Text("A")
}
}
} else {
Text("No Selected")
}
} detail: {
Text("Hi")
if let selected2 = selected2 {
Text(String(selected2))
}else{
Text("No Selected")
}
}
}
}
なんか色々やってもダメ
import SwiftUI
import CoreData
struct ContentView: View {
@State var selected:Int? = 1
@State var selected2:Int?
var body: some View {
NavigationSplitView {
List(selection: $selected){
NavigationLink(value: 1){
Text("A")
}
NavigationLink(value: 2){
Text("B")
}
NavigationLink(value: 3){
Text("C")
}
}
} content: {
VStack{
if let selected = selected {
Text(String(selected))
VStack(alignment:.leading){
ScrollView{
ForEach(0..<10000){index in
Text(index.description)
}
}
}
} else {
Text("No Selected")
}
}
.toolbar {
ToolbarItem(placement: .bottomBar) {
Text("A")
}
}
} detail: {
Text("Hi")
if let selected2 = selected2 {
Text(String(selected2))
}else{
Text("No Selected")
}
}
}
}