0

Hi everyone I am trying to display safari view as full screen modal using ZStack

        ZStack
        {
            HStack
            {
                VStack
                {
                    Safari(url: url)
                }
            }
        }
        .edgesIgnoringSafeArea(.all)
        .offset(x: 0, y: self.modalPresented ? 0 : 5000)

But the output I get is a white empty view. And also the navigation bar is still visible. Can someone please help me explain what is going on? https://i.stack.imgur.com/Qqd64.jpg

Johanna
  • 169
  • 3
  • 7

1 Answers1

0

This is how we call a url :

url = URL(string: "https://www.hackingwithswift.com") 
UIApplication.shared.open(url)

If you are using Scene delegate, then you should handle url first, so go to Scene delegate and add this fuction, if it does not exists already:

func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {

    guard let url = URLContexts.first?.url else {
        return
    }

    //Handle URL here
}

Then you url call should be like this:

UIApplication.shared.open(url, options: [:], completionHandler: nil)
Ghazi Tozri
  • 120
  • 7