how to open a binary webloc file with swift

I'm trying to get the url out of a binary webloc file, but I'm getting the follow error:

NSURLConnection finished with error - code -1002.
error: The file “link.webloc” couldn’t be opened.

Does anyone know how to read a binary webloc file with swift?

func readFile() {
    if let path = Bundle.main.path(forResource: "link", ofType: "webloc") {
      print("path: \(path)")
      if let url = URL(string: path) {
        do {
          let data = try Data(contentsOf: url)
          let plist = try PropertyListSerialization.propertyList(from: data, options: [], format: nil)
          print("plist")
        } catch {
          print("error: \(error.localizedDescription)")
        }
      }
    }
  }

I made a git repo of the project if anyone want to try it out. https://github.com/syclonefx/ReadWeblocFile.

I have 2 different webloc files the link.webloc is a binary webloc file and the link2.webloc is a text webloc file

how to open a binary webloc file with swift
 
 
Q