I think this is a bug, it only appears when I try to access a custom color in the Assets Catalog. The color is displayed correctly but I have an error in the console.
No color named '...' found in asset catalog for /private/var/containers/Bundle/Application/...
This only happens in views with Charts (I use the same assets in all the app and don't get this message.), and on device with the new iOS18 Beta. On simulator with other versions I don't have this problem.
The weirdest part is I only get the error about textColors not bgColors. (See the next example)
enum ColorPicked: Codable, CaseIterable, Identifiable {
var id: String { return self.bgColor.description }
case white
case red
var textColor: Color {
switch self {
case .red: return .textBetterRed
case .white: return .textBetterWhite
}
}
var bgColor: Color {
switch self {
case .white: return .betterWhite
case .red: return .betterRed
}
}
}
import SwiftUI
import Charts
struct Chart1: View {
let data: [ChartData1]
let color: ColorPicked
var body: some View {
ZStack{
VStack(alignment: .leading){
Text("Chart Title")
.foregroundStyle(color.textColor)
...
}.background(color.bgColor)
}
}
}
.fill()
in Xcode 16.0 beta 6 (16A5230g). Just reported a feedback, if you want to join and reference: FB14907314 – Joannjoanna