I can\'t seem to get the top most UIViewController
without access to a UINavigationController
. Here is what I have so far:
UIApplic
In a very rare case, with custom segue, the top most view controller is not in a navigation stack or tab bar controller or presented, but its view is inserted to the top of key windown's subviews.
In such situation, it's necessary to check if UIApplication.shared.keyWindow.subviews.last == self.view
to determine if the current view controller is the top most.