I have a Foundation macOS App written in Swift. I'm trying to use SwiftUI Chart View in NSViewcontroller (tutorial here) but it's seems import Charts
doesn't recognized and I obtain the error Cannot find 'Chart' in scope
and Cannot find 'LineMark' in scope
.
Any idea about the issue and how to resolve it ?
EDIT n.1
I've changed deployment target to macOS 13.0+ but still have the same error.
EDIT n.2
I've tried with this sintax (using foreach inside construction closure) but still have the same error.
var body: some View {
Chart {
ForEach(entries) { entry in
LineMark(x: .value("Time", entry.time),
y: .value("Temp", entry.temp))
.foregroundStyle(.red)
}
}
}