Xcode11 beta5中的Path.fill不再起作用 [英] Path.fill in Xcode11 beta5 doesn't work anymore
问题描述
Xcode11 beta5中swiftUI的Path.fill和.stroke不起作用
Path.fill and .stroke of swiftUI in Xcode11 beta5 doesn't work
下面的代码在Xcode beta4中工作正常,但在Xcode beta5中崩溃,我得到的所有错误信息都是:线程1:EXC_BAD_INSTRUCTION(代码= EXC_I386_INVOP,子代码= 0x0)
The code below works fine in Xcode beta4, but it crashes in Xcode beta5, the error information all I get :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中的一个已知问题.在其发行说明中披露:
It's a known issue in Beta 5. Disclosed in their release notes:
如果您使用的是路径结构,则可能会导致您的应用崩溃 Xcode 11 beta 5中包含的SDK.因此,您可能无法 成功遵循绘图路径和形状中的步骤 教程. (53523206)
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)
这篇关于Xcode11 beta5中的Path.fill不再起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!