xcode - 在 Alert() 中显示图像的 SwiftUI 扩展
问题描述
在 SwiftUI 中,标准警报具有以下操作:
public struct Alert {
/// Creates an alert with one button.
public init(title: Text, message: Text? = nil, dismissButton: Alert.Button? = nil)
/// Creates an alert with two buttons.
/// The system determines the visual ordering of the buttons.
public init(title: Text, message: Text? = nil, primaryButton: Alert.Button, secondaryButton: Alert.Button)
}
有没有办法为此警报编写扩展,允许我在标题和消息之间添加图像,所以我可以像这样使用它:
警报(标题:“标题”,图像:“image.png”,消息:“消息文本”,dismissButton:Alert.Button)
还是我必须为此创建自己的 AlertController?
解决方案
推荐阅读
- c# - 在 List 类型的主实体的子属性中搜索值
在另一个列表中 并返回主要实体 - javascript - 使用 addData 时 NetChart 不会自动重新排列节点
- python - Tensorflow Keras:在 model.fit() 上训练 Holting
- c# - C# - 通过 TCP/IP 轮询设备
- c# - 将数据从我的 MainDialog 传递到中间件
- python - 回调或生成器来处理重复代码块的特定部分?
- python - 合并两个排序列表并保留顺序
- c++ - 如何在 VsCode 上调试 C++/C 程序
- json - 在 JSON 中找到具有相同值的键
- python - 如何使用 PIL 中的 ImageTk/Image 调整图像大小