Xcode 11 beta 5 中的 Path.fill 不再有效

标签 path swiftui xcode11

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/

相关文章:

c++ - Windows 与 Linux GCC argv[0] 值

java - exec-maven-plugin 说不能运行指定的程序,即使它在 PATH 上

c# - 从完整文件名路径获取文件夹名称

ios - Xcode 11 - 产品/存档卡在通知扩展上

ios - IOS 13 上的后台任务(BGTaskScheduler)

java获取文件路径

ios - 不同 UI 元素的 SwiftUI 列表 - 失败

swiftui - 如何在 SwiftUI 中关闭工作表时刷新 View

swiftui - 使用 anchor 定位 View

swift - 尝试重命名变量时 Xcode 11.5 Rename Refactor 失败