我正在try 更改View的色调 colored颜色 .
我得到的是:
var body: some View {
Button {
selectedTab = title
} label: {
VStack(alignment: .center) {
image.renderingMode(.template)
Text(title)
}
.foregroundColor(selectedTab == title ? .accentColor : .black.opacity(0.2))
.padding()
}
}
The problem: When I use .accentColor(Color) in superview for this subview, Xcode said:
所以,我使用,就像在文档中:apple docs 101:
if #available(iOS 15.0, *) {
CustomTabView(tabs: "").tint(.red)
} else {
CustomTabView(tabs: "").accentColor(.green)
}
强调色很好,但.tint不行.我哪里做错了?