I have created a IOS Application in XCode 15.2 (15C500b) which causes issue not able to see previews.
In the Assets.xcassets folder I have created a ThemeColors which contains 5 Color Sets. I had used these in another Swift Project, and also used these same color sets in the second project. The First Project name was WC. The Second Project name is WCCardDemo stored in a different project folder.
Now when I copy or retype these color sets into the Project WCCardDemo, I get the following warnings in
Multiline
^ WCCardDemo X Command compiledAssetCatalog failed with nonzero exit code
-
The "GreenColor" color asset name resolves to a conflicting UI symbol "green. Try renaming the asset.
-
The "RedColor" color asset name resolves to a conflicting UI symbol "red. Try renaming the asset.
BlockQuote
When I try to refresh the startup default ContentView I get Failed to build the scheme WC
Content View
import SwiftUI
struct ContentView: View {
var body: some View {
ZStack {
Color.theme.background.ignoresSafeArea()
VStack {
Text("Accent Color")
.foregroundColor(Color.theme.accent)
Text("Seconday Text Color")
.foregroundColor(Color.theme.secondaryText)
Text("Red Color")
.foregroundColor(Color.theme.red)
Text("Green Color")
.foregroundColor(Color.theme.green)
}
}
.padding()
}
}
#Preview {
ContentView()
}
code-block
I also get the GeneratedAssetSymbols file displayed !! <GeneratedAssetSymbols.swift>
...
extension DeveloperToolsSupport.ColorResource {
...
/// The "BacktgroundColor" asset catalog color.
static var backtground: UIKit.UIColor {
#if !os(watchOS)
.init(resource: .backtground)
#else
.init()
#endif
}
#warning("The \"GreenColor\" color asset name resolves to a conflicting UIColor symbol \"green\". Try renaming the asset.")
#warning("The \"RedColor\" color asset name resolves to a conflicting UIColor symbol \"red\". Try renaming the asset.")
code-block
This appears to me to be xCode bug, and not a coding issue. I am asking if reusing assets and color sets File names in multple swift projects is bad practice. This does not make sense to me, that I can not reuse color set files ???. The first time I used the RedColor colorset name it was no issue. If i use it again in another separate Swift Project I get compile errors ??? Clean project does not fix this issue.
Thanks in Advance for any Information of best pratices, or what issue I am having.