In iOS 16 accentColor(_:) modifier has been deprecated, and Apple suggests using tint(_:) instead.
However, I found it does not work on the DatePicker. It works as expected on the Button, for instance. I was experimenting with applying .tint modifier on different levels but without success. .accentColor works as expected, though.
- In the example, I apply
.purpletint to the entireListview, so I expect it will be applied to all subviews. - I apply
.redtint to theDatePicker, which should override parent's tint. In the result, it has neither its own tint nor its parent's tint – it's the default (.blue) – not as expected. - I apply
.greentint to the firstButtonand it overrides parent's tint – as expected. - I do not apply any tint to the second
Button, so it inherits parent's tint (.purple) – as expected.
struct ContentView: View {
@State private var date = Date()
var body: some View {
List {
DatePicker("Date", selection: $date, displayedComponents: [.date])
.datePickerStyle(.graphical)
.tint(.red) // <- doesn't work
Button("Button with own tint") { }
.buttonStyle(.borderedProminent)
.tint(.green) // <- works
Button("Button with parent tint") { }
.buttonStyle(.borderedProminent)
}
.tint(.purple) // <- works on Button, but not on DatePicker
}
}
Am I doing something wrong, or is it some kind of SwiftUI's bug?

It seems that the color is converted by using
colorInvertandcolorMultiple.