Search code examples
swiftseguelandscape-portrait

How to dismiss a modal view by swiping downward when in landscape mode?


Everything is in the title, I don't know why and I'm sure the answer is right in front of me but when in landscape mode, my modally presented view goes full screen and I can't dismiss it by swiping down. Is it a normal behavior ? Is there a way to make it possible ?

I've searched for an answer but I haven't found anything yet. I tried to play with the Attribute Inspector of my view, especially the modalPresentationStyle but nothing is working.

I've attached screenshots of my storyboard, no code is involved, the button is triggering segue set to "present modally". When in portrait mode, everything is fine. I'm using Xcode 12.1.

enter image description here

enter image description here

Thank you for your help !


Solution

  • Yes, this looks like the default behavior. Even in native apps, you can't dismiss any modal presentation in the landscape.

    The reason for this seems clear. In the landscape, it is presented fullscreen. Due to the full-screen presentation, it will not be an obvious gesture to swipe down to dismiss. And presenting the same as portrait mode is not possible because of the height available.