Learn Courses My Dashboard

Customise Firebase Facebook Auth login button

Hi all,
Im somewhat new to SwiftUI and have encountered something i cannot fix myself.
So im working with SwiftUI. And have successfully created a login page with firebase facebook authentication.
And all the functionalities work just fine, but i would like to customise the default/built-in login/logout button.
Would really appreciate some help

This is the code i use for authentication:

    import SwiftUI
    import FBSDKLoginKit
    import Firebase

    struct LoginView : UIViewRepresentable {
        func makeCoordinator() -> LoginView.Coordinator {
            return LoginView.Coordinator()            
        func makeUIView(context: UIViewRepresentableContext<LoginView>) -> FBLoginButton {
            let button = FBLoginButton()
            button.permissions = ["email", "public_profile"]
            button.delegate = context.coordinator
            return button
        func updateUIView(_ uiView: FBLoginButton, context: UIViewRepresentableContext<LoginView>) {
        class Coordinator : NSObject, ObservableObject,LoginButtonDelegate{
            func loginButtonDidLogOut(_ loginButton: FBLoginButton) {
                try! Auth.auth().signOut()
                print("Did logout")        
            func loginButton(_ loginButton: FBLoginButton, didCompleteWith result: LoginManagerLoginResult?, error: Error?) {
                if error != nil  {
                if AccessToken.current != nil {
                    let credential = FacebookAuthProvider.credential(withAccessToken: AccessToken.current!.tokenString)
                    Auth.auth().signIn(with: credential) {(res ,  er) in

                        if er != nil{

in your makeUIView you can customize the button appearance programmatically by accessing its properties like



Thanks for the answer, so i tried doing this

But there doesn’t seem to be a .text property. When trying to run the code i get the error shown in the image above.
Do you have any ideas on how it can be fixed?
Btw im using SwiftUI