最初の画面を認証済みユーザーと新規ユーザーとで切り替えたい時の処理
import UIKit
import Firebase
import FirebaseUI
class LaunchViewController : UIViewController{
override func viewDidLoad() {
super.viewDidLoad()
//ロードされるまでの初期画面(ロゴ画像、ナビゲーションバーなど)
}
}
override func viewDidAppear(_ animated: Bool) {
if Auth.auth().currentUser != nil {
self.performSegue(withIdentifier: "sign", sender: nil)
print(認証済みユーザー)
} else {
self.performSegue(withIdentifier: "nosign", sender: nil)
print(新規ユーザー)
}
}
}
ポイントはAuth.auth().currentUser != nilのif文
Swiftのお役立ち情報