SignInWithAppleButton doesn't change style on colorScheme changes.

I'm trying to make SignInWithAppleButton.Style black when colorScheme is light and white when colorScheme is dark, but .signInWithAppleButtonStyle modifier doesn't update the view when colorScheme change.

Code Block swift
struct LogInView: View {
@Environment(\.colorScheme) private var colorScheme
var body: some View {
SignInWithAppleButton { _ in } onCompletion: { _ in }
.signInWithAppleButtonStyle(colorScheme == .light ? .black : .white)
.frame(height: 50)
.padding()
}
}


This can be seen in build and in preview:


Code Block swift
struct LogInView_Previews: PreviewProvider {
static var previews: some View {
Group {
LogInView()
LogInView()
.preferredColorScheme(.dark)
}
}
}



You need solve it like following, I don't know why apple design it like this.
Code Block
import SwiftUI
import AuthenticationServices
struct ContentView: View {
@Environment(\.colorScheme) var currentScheme
var body: some View {
if self.currentScheme == .light {
SignInWithAppleButtonView()
.signInWithAppleButtonStyle(.black)
} else {
SignInWithAppleButtonView()
.signInWithAppleButtonStyle(.white)
}
}
}
struct SignInWithAppleButtonView: View {
var body: some View {
SignInWithAppleButton(
.signUp,
onRequest: {_ in },
onCompletion: {_ in }
)
}
}



SignInWithAppleButton doesn't change style on colorScheme changes.
 
 
Q