iT邦幫忙

2021 iThome 鐵人賽

DAY 23
0

先丟github連結!晚點再補內容嗚嗚嗚
居然還有300字以上的限制XDD

ProfileViewController

        let actionSheet = UIAlertController(title: "Sure to sign out",
                                            message: "",
                                            preferredStyle: .actionSheet)

        actionSheet.addAction(UIAlertAction(title: "Sign out",
                                            style: .destructive,
                                            handler: { [weak self] _ in
                                                guard let strongSelf = self else{
                                                    return
                                                }

                                                do {
                                                    try FirebaseAuth.Auth.auth().signOut()

                                                    let vc = LoginViewController()
                                                    let nav = UINavigationController(rootViewController: vc)
                                                    nav.modalPresentationStyle = .fullScreen // if not-> pop up as a card
                                                    strongSelf.present(nav, animated: true)
                                                }
                                                catch {
                                                    print("Fail to log out")
                                                }
                                            }))

        actionSheet.addAction(UIAlertAction(title: "Cancel",
                                            style: .cancel,
                                            handler: nil))

        present(actionSheet, animated: true)

上一篇
Day#22 一直忘記實作的Logout
下一篇
Day#24 尋找其他使用者(1)
系列文
來寫看看app好了! Swift探索之旅30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言