I'm reading this (good) post from SO to implement bookmarks for security scoped URL.
h ttps://stackoverflow.com/questions/31278869/file-access-in-a-sandboxed-osx-app-with-swift
At the beginning, they have :
func bookmarkPath() -> String {
var url = app.applicationDocumentsDirectory
url = url.appendingPathComponent("Bookmarks.dict")
return url.path
}
I cannot figure out how app is defined. Is it the appDelegate ? Its controller ? I've tried many variations unsuccessfully.
How should I define app ?
I ended up replacing
var url = app.applicationDocumentsDirectory
by :
var url = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0] as URL
Is that equivalent ?