present ViewController calling viewWillDisappear but does not call viewWillAppear

1.3k Views Asked by At

Following is my code present safari view controller

 if let url = URL(string: "https://www.ggogle.com.com/") {
            let config = SFSafariViewController.Configuration()
            config.entersReaderIfAvailable = true
            let vc = SFSafariViewController(url: url, configuration: config)
            present(vc, animated: false)


        }

Above code calls viewWillDisappear but does not call viewWillAppear when presented view controller is dismissed.

Also found that after view is dismissed viewWillDisappear is not called at all for any other pushViewController

How to fix this?

Update on this:

Tried navigation controller and set its delegate and implemented following methods

navigationController:willShowViewController:animated:
navigationController:didShowViewController:animated:

This is not working as well.

Update on this tried following code

  vc.modalPresentationStyle = .currentContext

But using this tab bar does not hides and controller not appearing full screen and there is no option like hide bottom bar on present.

1

There are 1 best solutions below

1
On

Please try this

 if let url = URL(string: "https://www.google.com/") {
            let config = SFSafariViewController.Configuration()
            config.entersReaderIfAvailable = true
            let vc = SFSafariViewController(url: url, configuration: config)

            vc.modalPresentationStyle = .currentContext

            present(vc, animated: false)

        }

UPDATE

vc.modalPresentationStyle = .currentContext
tabBarController?.present(viewController, animated: false, completion: nil)