Advertisement
Larme

Untitled

May 13th, 2020
503
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 0.57 KB | None | 0 0
  1. let fileManager = FileManager.default
  2. guard fileManager.fileExists(atPath: path) else { print("File doesn't exists"); return }
  3. do {
  4.     let attributes = try fileManager.attributesOfItem(atPath: path)
  5.     guard let extendedAttributes = attributes[FileAttributeKey(rawValue: "NSFileExtendedAttributes")] as? [String: Any] else { return }
  6.     guard let data = extendedAttributes["com.apple.metadata:kMDItemWhereFroms"] as? Data else { return }
  7.     let urls = try PropertyListDecoder().decode([String].self, from: data)
  8.     print(urls)
  9. } catch {
  10.     print("Error: \(error)")
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement