English 中文(简体)
缩略语
原标题:GeneratedAssetSymbols error "Ambiguous use of ..." in Xcode 15

我转而谈到Xcode 15的新特征,现在我的建筑已经失败。 热塑AsetSymbols大约13k条线,其中约1k条落空。

这些失误均载于<代码>SwiftUI.Color推广。 与此类似:

static var gr150: SwiftUI.Color { .init(.gr150) }

<代码>本候选人表示:

/// The "gr150" asset catalog color.
static var gr150: AppKit.NSColor {
    #if !targetEnvironment(macCatalyst)
        .init(resource: .gr150)
    #else
        .init()
    #endif
}

以及

/// The "gr150" asset catalog color resource.
static let gr150 = ColorResource(name: "gr150", bundle: resourceBundle)

如何解决这一问题的想法? 或放弃基因组代谢物?

这是马库西斯快速倡议的目标。

问题回答

我认为的唯一原因是,你在某个地方添加了自己的<代码>Color.init,该编码使用NSColor,或许是因为你当时不想写nsColor:参数标签。 e.g.

extension Color {
    init(_ color: NSColor) { self.init(nsColor: color) }
}

这将使<代码>Color(.gr150)变得模糊不清。 它可以称作Color.init(ColorResource),或可称为Color.init(NSColor)


Otherwise, I m not sure why it is ambiguous. You can turn the generation off by setting the "Generate Swift Asset Symbol Extensions" setting off.

“在此处的影像描述”/</a

这仍然会产生基因组代谢物,但只有<编码>ColorResource和ImageResource,因此,在使用你的颜色时,你仍可以避免打上字面。 你需要做:

Color(.gr150)
// or
NSColor(resource: .gr150)

NSColor.gr150上下台以来,第一版已不复存在。

如果你只需要“快速识别码”的延伸,那么你仍然可以“紧急信号资产展期”,并且只在“紧急资产框架支助”中加上“盗窃”。

“entergraph

This way, you still get Color.gr150, and since NSColor.gr150 is gone, the generated .init(.gr150) will not longer be ambiguous.





相关问题
How to change out-of-focus text selection color in Xcode?

Okay, I ll bite. I ve got really pleasant code/window colors set up in Xcode. Ordinarily, my selection color is very visible. When I am doing a project search and iterating through the results, ...

Iphone NSTimer Issue

Hi I am new to objective c. I am trying to make an app for iphone. I have a button on my view, and the click on which the function playSound is called. This is working properly. It does plays the ...

Include a .txt file in a .h in C++?

I have a number of places where I need to re-use some template code. Many classes need these items In a .h could I do something like: #include <xxx.txt> and place all of this code in the ....

Iterating over string/strlen with umlauted characters

This is a follow-up to my previous question . I succeeded in implementing the algorithm for checking umlauted characters. The next problem comes from iterating over all characters in a string. I do ...

Xcode open two editor windows with same file

Is it possible to open the same file in two separate windows in Xcode. I can open a file in one window and the same file in the main Xcode editor window, but I wanted two separate fulltime editor ...

Forcing code signing refresh in Xcode

In our environment, we share resources across multiple projects and platforms. When building for iPhone, only a subset of those resources are needed. Since that subset is still considerable, we have ...

热门标签