Skip to main content

Command Palette

Search for a command to run...

FIREBASE CRUD disconnect

Etape 3

Updated
•1 min read•View as Markdown

Dans le fichier "FireAuth.swift", implémenter la fonction "signOut()"

func signOut() {
        do {
            try Auth.auth().signOut() // signOut() : throws donc do/catch
        } catch {
            print(error.localizedDescription)
        }
    }

Appeler cette fonction pour la déconnexion , dans le controller dédié

(par exemple le profil controller, avec un bouton "Déconnexion")

@IBAction func disconnect(_ sender: UIButton) {
        if FireAuth().isAuth() {
            FireAuth().signOut()
           performSegue(withIdentifier: "ToRoot", sender: nil)

        }
    }

Ici la déconnexion ramène à la page d'authentification.

FIREBASE

Part 3 of 13

Examples of using different Firebase methods

Up next

FIREBASE CRUD récupérer nom et prénom

Etape 4

More from this blog

F

Fred iOS tutorials

31 posts