Xcode11 beta5 中的 Path.fill 不再起作用 [英] Path.fill in Xcode11 beta5 doesn't work anymore

查看:17
本文介绍了Xcode11 beta5 中的 Path.fill 不再起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Xcode11 beta5 中swiftUI 的Path.fill 和.stroke 不起作用

Path.fill and .stroke of swiftUI in Xcode11 beta5 doesn't work

下面的代码在 Xcode beta4 中运行良好,但在 Xcode beta5 中崩溃了,我得到的所有错误信息:Thread 1: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode = 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:

使用 Path 结构可能会导致您的应用程序崩溃,如果您正在使用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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆