swiftUI 在Xcode11 beta5 中的Path.fill 和.stroke 不起作用
下面的代码在 Xcode beta4 中运行良好,但在 Xcode beta5 中崩溃,我得到的所有错误信息:Thread 1: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode = 0x0)
代码:
import SwiftUI
struct ContentView: View {
var body: some View {
Path{path in
path.addRect(CGRect(x: 20, y: 20, width: 300, height: 200))
}.fill(Color.red)
}
}
#if DEBUG
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
#endif
最佳答案
这是 Beta 5 中的一个已知问题。在他们的发行说明中披露:
Using the Path structure may cause your app to crash if you’re using the SDKs included in Xcode 11 beta 5. As a result, you may be unable to successfully follow the steps in the Drawing Paths and Shapes tutorial. (53523206)
关于Xcode 11 beta 5 中的 Path.fill 不再有效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57322366/