Firebaseへ匿名ユーザーのログイン
Authenticationのログイン方法はmail/password, Anonymousを有効にする
@IBAction func loginOutClicked(_ sender: Any) {
guard let user = Auth.auth().currentUser else { return }
if user.isAnonymous {
presentLoginController()
} else {
do {
try Auth.auth().signOut()
Auth.auth().signInAnonymously { (result, error) in
if let error = error {
debugPrint(error)
}
self.presentLoginController()
}
} catch {
debugPrint(error)
}
}
}