my code is very simple, in ContentView.swift file:
import SwiftUI
struct NavTab {
let name: String
}
let tab0 = NavTab(name: "tab0")
struct ContentView: View {
var body: some View {
Text("Hello, world!")
.onAppear {
print("tab0.name is \(tab0.name)") // Line 1
}
}
}
Run the code, it will print tab0.name is "tab0", that's right.
But if you add a breakpoint at Line 1, then interrupted at the breakpoint, enter "po tab0.name" in debug console, you will see tab0.name is equal to "":
(lldb) po tab0.name
""
(lldb) po tab0
▿ NavTab
- name : ""
Why is that? Am I misunderstanding something? Thanks! ;)