-1

Apple introduced card style presentation with iOS13 i.e (https://medium.com/@hacknicity/view-controller-presentation-changes-in-ios-13-ac8c901ebc4e). With this change all pagesheets and formsheets will show up as card with a feature to dismiss as swipe that apple gives us. Now we have two ways to dismiss the app.

  1. Dismiss with swipe
  2. Dismiss by clicking close/cancel button on presented controller

The things affected by this change. Since view is no longer removed from hierarchy, life cycle methods like (viewWillAppear, viewDidAppear, viewWillDisappear, viewDidDisappear) won't be invoked on the presentedViewController.

I have several modals in my app. Is there a better way to handle this situation where my life cycle methods get invoked instead of writing delegates throughout the app and calling them only for iOS13 as earlier versions they will get invoked.

Also tried setting isInModalPresentation = true which will stop the dismissing functionality. But, Dismiss by clicking close/cancel button on presented controller will still not call life cycle methods in the presenting view controller.

I don't want them to force them to fullscreen as well.

The uiadaptivepresentationcontrollerdelegate methods are called only if user dismisses via swipe. So need a better way to handle the delegates instead of changing code throughout the app.

kushanky
  • 167
  • 1
  • 9

1 Answers1

-2

Use secondViewController.modalPresentationStyle = .fullScreen before presenting the secondViewController controller.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Amir Khan
  • 1,318
  • 1
  • 14
  • 39