Это работает с Swift 4.2.Вы должны добавить этот метод в свой viewController для поддержания портретной ориентации
override var supportedInterfaceOrientations:UIInterfaceOrientationMask {
return UIInterfaceOrientationMask.portrait
}
, и вы также должны объявить
let appDelegate = UIApplication.shared.delegate as! AppDelegate
Также в вашем AppDelegate вы должны добавить
var myOrientation: UIInterfaceOrientationMask = .portrait
func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
return myOrientation
}
и это при создании SFSafariViewController
let appDelegate = UIApplication.shared.delegate as! AppDelegate
appDelegate.myOrientation = .all