1

In iOS 13, when we present a new ViewController

         let newVC = NewViewController()
         self.present(newVC, animated: true)

it looks like below, where it is not FullScreen, and can be swipe down to move back to the launching ViewController

enter image description here

To make it FullScreen, we can just use .fullScreen as shown below.

         let newVC = NewViewController()
         newVC.modalPresentationStyle = .fullScreen
         self.present(newVC, animated: true)

It will look like below, which is full screen. However, it doesn't allow me to swipe down to get back to the parent anymore.

enter image description here

Is there a way to swipe back and get back to Parent still with FullScreen on?

Elye
  • 53,639
  • 54
  • 212
  • 474
  • https://stackoverflow.com/questions/57803695/is-it-possible-to-use-swipe-to-dismiss-while-presenting-a-fullscreen-modal-in-io – finebel Nov 07 '20 at 10:13
  • You would need to write a custom interactive transition animation. – matt Nov 07 '20 at 15:51

1 Answers1

3

You could try the following example:

class ViewController: UIViewController {
    
    override func viewDidLoad() {
        super.viewDidLoad()
    }

    //Button is added via storyboard
    @IBAction func presentButtonDidTap(_ sender: UIButton) {
        let vc = NewViewController()
        vc.modalPresentationStyle = .fullScreen
        present(vc, animated: true)
    }
}

class NewViewController: UIViewController {
    
    override func viewDidLoad() {
        self.view.backgroundColor = .gray
        
        let gesture = UISwipeGestureRecognizer(target: self, action: #selector(dismissVC))
        gesture.direction = .down
        view.isUserInteractionEnabled = true // For UIImageView
        view.addGestureRecognizer(gesture)
    }
    
    @objc
    private func dismissVC() {
        dismiss(animated: true)
    }
}

Elye
  • 53,639
  • 54
  • 212
  • 474
finebel
  • 2,227
  • 1
  • 9
  • 20