Issue #894
Use a UIView
as source view and set it in background
class ViewModel {
lazy var sourceView = UIView()
}
struct SourceView: UIViewRepresentable {
let viewModel: ViewModel
func makeUIView(context: Context) -> UIView {
viewModel.sourceView
}
func updateUIView(_ uiView: UIView, context: Context) {}
}
Button(action: {
onShowAlert(viewModel.sourceView)
}) {
Image(systemName: "bookmark")
}
.background(SourceView(viewModel: viewModel))
let alertController = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
alertController.popoverPresentationController?.sourceView = viewModel.sourceView