Get top most UIViewController in Swift
To get the topmost view controller in Swift you need to take into account the presented viewcontrollers. This can be achieved in the following ways You also need to take into account iOS 13 + versions Happy coding !!!