URL (via .fileImporter) to a ReadConfiguration - How to?

I've defined a FileDocument with an init(configuration: ReadConfiguration) .... I've got a URL via .fileImporter - now I'd like to actually read and process (the JSON content). How do I get the ReadConfiguration from the URL? (And what would I search for to avoid this probably trivial issue?)

Of course, I wrote the JSON file in the first place... so I could just read the contents as Data and decode it to JSON. But then what is the point of FileDocument other than to provide .fileExporter with a required argument?

The .fileImporter modifier isn't for opening your SwiftUI app's documents. It's for opening other types of files in your app. The document struct's init that takes a ReadConfiguration is for opening your app's documents, either from a document picker (iOS) or by choosing File > Open (Mac).

Instead of using your document struct's init that takes a ReadConfiguration, write a function to process the JSON that takes a URL as an argument. Pass the URL the file importer gives you to the JSON processing function.

URL (via .fileImporter) to a ReadConfiguration - How to?
 
 
Q