我正在使用 SwiftUI 为 MacOS 开发基于 Python 的图形计算器。
https://github.com/snakajima/macplot
我正在使用 SwiftUI 的 TextEditor 作为 Python 代码的编辑器,但我无法弄清楚如何禁用智能引号(UITextInputTraits、smartQuotesType: UITextSmartQuotesType)。
VStack {
TextEditor(text: $pythonScript.script)
HStack {
Button(action: {
pythonScript.run(clear: settings.shouldClear)
}, label: {
Text("Plot")
})
Toggle("Clear", isOn: $settings.shouldClear)
}
if let errorMsg = pythonScript.errorMsg {
Text(errorMsg)
.foregroundColor(.pink)
}
}