Skip to content

Instantly share code, notes, and snippets.

@malonehedges
Created September 16, 2020 15:46
Show Gist options
  • Save malonehedges/b4bccde899b15a391c052bf43e5bdcd7 to your computer and use it in GitHub Desktop.
Save malonehedges/b4bccde899b15a391c052bf43e5bdcd7 to your computer and use it in GitHub Desktop.
import SwiftUI
import AuthenticationServices
final class SignInWithAppleButton: UIViewRepresentable {
let buttonType: ASAuthorizationAppleIDButton.ButtonType
let style: ASAuthorizationAppleIDButton.Style
let cornerRadius: CGFloat?
init(
buttonType: ASAuthorizationAppleIDButton.ButtonType = .signIn,
style: ASAuthorizationAppleIDButton.Style = .black,
cornerRadius: CGFloat? = nil
) {
self.buttonType = buttonType
self.style = style
self.cornerRadius = cornerRadius
}
func makeUIView(context: Context) -> ASAuthorizationAppleIDButton {
let button = ASAuthorizationAppleIDButton(
type: self.buttonType, style: self.style
)
if let cornerRadius = self.cornerRadius {
button.cornerRadius = cornerRadius
}
return button
}
func updateUIView(_ uiView: ASAuthorizationAppleIDButton, context: Context) {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment