I have a json file stored in the FileManager of my app and I want to access and decode it for my widget. I use the following url for the file:
let documentDirectory = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!
let jsonURL = documentDirectory
.appendingPathComponent(filename)
.appendingPathExtension("json")
where filename is "list".
However I don't think the target can access the file in my app's FileManager as I get the error Fatal error: 'try!' expression unexpectedly raised an error: Error Domain=NSCocoaErrorDomain Code=260 "The file “list.json” couldn’t be opened because there is no such file."
There might be some extra details you can use from my previous question