Just a simple Tabbed App xcodeproj in SwiftUI.
Add a picker like this aaand: crash at runtime when switching to second tab.
import SwiftUI
struct ContentView : View {
@State private var selection = 0
@State private var pickerselection = 3
let numbers = ["1", "2", "3", "4", "5"]
var aTitle: String = "Title"
var body: some View {
TabbedView(selection: $selection) {
// ADD ONLY THIS PART TO A NEW TABBED APP SWIFTUI PROJECT //// BEGIN /////
VStack{
Text("First View")
.font(.title)
Picker(selection: $pickerselection, label:
Text(aTitle)) {
ForEach(0 ..< numbers.count) { index in
Text(self.numbers[index]).tag(index)
}
}
}
////// XCODE 11.0 BETA 2 ONLY//////// END ////////////
.tabItemLabel(Image("first"))
.tag(0)
Text("Second View")
.font(.title)
.tabItemLabel(Image("second"))
.tag(1)
}
}
}
#if DEBUG
struct ContentView_Previews : PreviewProvider {
static var previews: some View {
ContentView()
}
}
#endif
Compiles, but runtime crash when switching tabs:
Thread 1: EXC_BAD_ACCESS (code=1, address=0x8)
Problem seems solved in XCode 11 beta 5.