Hi, I'm a beginner in Swift and I'm stuck. I just want a simple app that displays the image of the selected file on disk (not Assets) in a rectangle above "Hello world!". Thanks for any help!
struct ContentView: View { var body: some View { VStack {
// Rectangle example
rectangle()
.frame(width: 300, height: 300, alignment: .topLeading)
Text("Hello, World!")
Button("Select File"){
let pathfile = fSelectFile() //"....../Data/Image1.jpg"
let img = NSImage(byReferencingFile: pathfile)
img!.draw(in: NSRect(x: 10, y: 10, width: 300, height: 300))
}
}
}
}