Closed likeaj6 closed 7 years ago
Was able to fix by changing this line in the show function of the Popover
guard let rootView = UIApplication.shared.windows.last ?? UIApplication.shared.keyWindow else { return }
changed to
guard let rootView = UIApplication.shared.keyWindow else { return }
I noticed that the popover in my app wasn't showing consistently. I kept playing around and figured out that the popover only starts appearing after a transition or alert(perhaps other conditions can work too, but these are the only two I've found so far) on the view controller has occurred.
Other UI changes such as changes in frames of the embedded views in the view controller don't affect it at all. I stepped through the popover initialization in the debugger and any popover before an alert or transition would have a containerView and contentViewFrame that are both nil.
Perhaps has to do with the view/window that popover is presenting from? How can I fix this?