0

For UIKit, I was able to bring a view controller as a top view on keyWindow (It's included both tabbar and status bar too) for example active call view by using below function.

func sendVCToTopViewController(_ vc: UIViewController) {
    let topViewController = UIApplication.shared.keyWindow?.rootViewController
    topViewController?.addChild(vc)
    topViewController?.view.addSubview(vc.view)
    topViewController?.view.bringSubviewToFront(vc.view)
}

But I couldn't find a way about how to make it similar on SwiftUI with a view's struct. I want to continue seeing other views where I left off after dismiss that view.

iamburak
  • 3,508
  • 4
  • 34
  • 65
  • 2
    In majority of SwiftUI cases it will be enough to use ZStack (at root level), but if it is needed more (to overlap system views, like sheet) consider answer in https://stackoverflow.com/a/63647579/12299030. – Asperi Sep 01 '20 at 18:39
  • @Asperi thanks for sharing how sheet presentation working on SwiftUI. About ZStack, I figured out that with this answer: https://stackoverflow.com/a/63699142/6135652 - It can help others too. – iamburak Sep 02 '20 at 08:09

0 Answers0