Have this code:
struct ContentView: View {
var d1: [String: Any]? = nil
var res: ValidationResult?
let documentPicker = UIDocumentPickerViewController(forOpeningContentTypes: [.jpeg, .png])
documentPicker.delegate = self // <----- HERE
documentPicker.modalPresentationStyle = .overFullScreen
raise: Expected declaration
Why? What is wrong?
Also how can I start to show document view controller? How to get a reference to a viewcontroller?
Unfortunatelly this crashes:
var body: some View {
VStack {
Button(action: {
documentPicker.present(documentPicker, animated: true)
}){ Text("Load JSON schema").padding() }
I found this for document handling: https://maheshsai252.medium.com/document-handling-in-swiftui-664cf050c724
Strange it does not have body
like this:
var body: some View {
VStack {
why?