swiftUI怎么print

2024-12-16

在view里声明变量

输入let _ = print()

var body: some View {
        let _ = print(Realm.Configuration.defaultConfiguration.fileURL)
}

在Button下面直接print

Button {
    print("Button tapped")
} label: {
    Image(systemName: "plus")
}

参考链接