In this lesson, I had to use .foregroundColor(Color(“DarkTextColor”)) as opposed to “TextColor” because the icon could not be seen with the white background. In the lessons before we defined the color “DarkTextColor” in the Assets.xcassets. not “TextColor”.
Not sure if I did something wrong or missed a step but my code is this:
//
// RoundedViews.swift
// Bullseye
//
// Created by Chuck Condron on 12/8/22.
//
import SwiftUI
struct RoundedImageViewStroked: View {
var systemName: String
var body: some View {
Image(systemName: systemName)
.font(.title)
.foregroundColor(Color("DarkTextColor"))
.frame(width: 56.0, height: 56.0)
}
}
struct RoundedImageViewFilled: View {
var systemName: String
var body: some View {
Image(systemName: systemName)
.font(.title)
.foregroundColor(Color("DarkTextColor"))
.frame(width: 56.0, height: 56.0)
}
}
struct PreviewView: View {
var body: some View {
VStack( spacing: 10) {
RoundedImageViewStroked(systemName: "arrow.counterclockwise")
RoundedImageViewStroked(systemName: "list.dash")
}
}
}
struct RoundedViews_Previews: PreviewProvider {
static var previews: some View {
PreviewView()
PreviewView()
.preferredColorScheme(.dark)
}
}
it seems to work just perfect in both dark and normal mode previews. Please advise…