swiftui - 当我们在 View Xcode 13 中使用确认对话框时,没有显示警报
问题描述
struct ConfirmationDialog: View {
@State private var showingOptions = false
@State private var showingAlert = false
var body: some View {
VStack {
Button("Show Options") {
showingOptions = true
}
.alert("Alert Title", isPresented: $showingAlert, actions: {
Button {
// Do nothing
} label: {
Text("Okay")
}
}, message: {
Text("Alert Message")
})
.confirmationDialog("Select option", isPresented: $showingOptions, titleVisibility: .visible) {
Button("Show Alert") {
self.showingAlert = true
}
}
}
}
}
当我在单个视图中使用确认对话框和警报时,警报不会出现。
当第一次出现确认对话框时,我得到一个控制台日志。
在已显示确认对话框时尝试显示警报。这是不支持的。
我正在使用 XCode 13 和 iOS 15 模拟器
它是 XCode 13 中的错误吗?
解决方案
推荐阅读
- intellij-idea - 将intellij项目添加到gitlab时出错
- sql - 如何根据组内日期之间的差异更改列?
- java - 将二维数组打印为字符串问题 - java
- html - 在关闭之外访问 OnItemDataBound 数据
- python - 为不同参数返回相同输出值的函数 - python 3.8
- javascript - React - 将 Lottie 动画 / gif 链接到输入范围滑块
- php - Laravel 哈希密码
- java - 无法退出 Java 中的 while 循环
- spring - Spring Security OAuth2:如何通过在到期时生成新的 oauth2 令牌来重新授权令牌
- r - 手动创建带有科学计数法标签的绘图轴(标签与坐标值不同)