I know that the normal behavior on iPad is to show a popover view while on iPhone it switches to a full screen, but I don't want the full screen on the smaller devices. Is there a way to prevent this? In UIKit we could override the adaptivepresentationstyle func like this(from https://stackoverflow.com/a/50428131/412154)
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
}
}
wondering if anyone found something similar to override for swiftui
thanks for the help!