Это iOS 14 и SwiftUI:
Код: Выделить всё
@Environment(\.colorScheme) var currentScheme
@State var appleButtonWhite = false
VStack{
SignInWithAppleButton(
.signUp,
onRequest: { request in
request.requestedScopes = [.fullName, .email]
},
onCompletion: { result in
switch result {
case .success (let authResults):
print("Authorization successful.")
case .failure (let error):
print("Authorization failed: " + error.localizedDescription)
}
}
)
.frame(minWidth: 0, maxWidth: .infinity)
.signInWithAppleButtonStyle(appleButtonWhite ? .white : .black)
}
.onChange(of: currentScheme, perform: { (scheme) in
if scheme == .light
{
appleButtonWhite = false
}
else
{
appleButtonWhite = true
}
})
Подробнее здесь: https://stackoverflow.com/questions/654 ... lor-scheme
Мобильная версия