my view is controlled by a navigation controller, so I set the supported orientations in to the navigation controller to explicitly portrait & portraitUpSideDown and this wo
You can change your orientation back to portrait before dismissing it:
UIDevice.current.setValue(UIInterfaceOrientation.portrait.rawValue, forKey: "orientation") dismiss(animated: true) { _ in print("dismissed in Portrait mode") }