-6

This is incredibly frustrating as I knew how to do this in Swift 2. I am building a message app extension and in a class in my footer in a collection view, I am just trying to open a url. Ive looked at every other post I swear but I get the same errors.

I am trying to do this:

let url = URL(string: "url here")
        UIApplication.shared.open(url!, options: [:], completionHandler: nil)

But I get the errors: enter image description here

This should be simple. What am I doing wrong here?

enter image description here

blue
  • 7,175
  • 16
  • 81
  • 179

1 Answers1

1

go this way,

let phoneUrl = "tel://45657657" //your url
      if let url = URL(string: phoneUrl){
           if #available(iOS 10.0, *) {
              UIApplication.shared.open(url, options: [:])
            } else {
              // Fallback on earlier versions
            }
       }
john afordis
  • 317
  • 3
  • 15