Present Safari View Controller Modally instead of Pushby
When I launch safari view controller(SFSafariViewController) by way of
present(_:animated:completion:) method, I do not get the default modal transition behaviour, instead the transition is that of push (sliding in from the right), as if I called
SFSafariViewControllerAn object that provides a visible standard interface for browsing the web.
The solution was to set transition delegate to self or controller from where safari controller is being presented. Lastly adopt the UIViewControllerTransitioningDelegate with no need to implement any of the protocol methods as they are optional.
UIViewControllerTransitioningDelegateA set of methods that vend objects used to manage a fixed-length or interactive transition between view controllers.
let svc = SFSafariViewController(url: url) svc.transitioningDelegate = self //neat solution to make it use default modal presentation instead of push present(svc, animated: true, completion: nil)
Remember again, we need to adopt the UIViewControllerTransitioningDelegate protocol in our view controller, but there are no required functions to implement.
You might also like: AVAudioPlayer not playing any sound
You might also like: How to Get Substring With NSRange in Swift 5
You might also like: How to Fix Warning Attempt To Present UIAlertController