Я знаю, что обычным поведением iPad является отображение всплывающего окна, в то время как на iPhone он переключается в полноэкранный режим, но мне не нужен полноэкранный режим на небольших устройствах. Есть ли способ предотвратить это? В UIKit мы могли бы переопределить адаптивный стиль представления c следующим образом (от { ссылка })
class ViewController: UIViewController {
@IBAction func doButton(_ sender: Any) {
let vc = MyPopoverViewController()
vc.preferredContentSize = CGSize(400,500)
vc.modalPresentationStyle = .popover
if let pres = vc.presentationController {
pres.delegate = self
}
self.present(vc, animated: true)
if let pop = vc.popoverPresentationController {
pop.sourceView = (sender as! UIView)
pop.sourceRect = (sender as! UIView).bounds
}
}
}
extension ViewController : UIPopoverPresentationControllerDelegate {
func adaptivePresentationStyle(for controller: UIPresentationController, traitCollection: UITraitCollection) -> UIModalPresentationStyle {
return .none
}
}
интересно, нашел ли кто-нибудь что-то похожее на переопределение для swiftui
спасибо за помощь!