3

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.

amodkanthe
  • 4,345
  • 6
  • 36
  • 77
  • Parent's ViewWillAppear not called when a view controller is dismissed. What we can do either use delegate or completion of dismiss method. – Pawan Kumar Aug 31 '19 at 10:53
  • updated question Also found that after view is dismissed viewWillDisappear is not called at all for any other pushViewController – amodkanthe Aug 31 '19 at 11:00
  • [https://stackoverflow.com/questions/131062/iphone-viewwillappear-not-firing](https://stackoverflow.com/questions/131062/iphone-viewwillappear-not-firing) A good read. – cora Sep 05 '19 at 14:06
  • dimissing a controller will not call viewWillappear of dimissed controller, but it will call viewWillAppear of controller that is going to display after dismissed controller. – Abu Ul Hassan Sep 20 '19 at 10:01

1 Answers1

0

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)
niku
  • 472
  • 3
  • 12