How to add a bar button to a navigation bar – free Swift 4 example code and tips

How to add a bar button to a navigation bar – free Swift 4 example code and tips

firebase auth와 facebook, google oauth를 이용 사용자의 접속을 관리하는 경우. 사용자가 sign out작업을 하면 두단계로 이를 처리한다. 우선 firebase auth 단계에서 처리하고 각각 google, facebook에서도 개별 처리해주어야 한다.

https://stackoverflow.com/a/42002262

facebook의 예시

You don’t need completion blocks, as the method is synchronous.

@IBAction func logOut(_ sender: UIButton) {
    guard FIRAuth.auth()?.currentUser != nil else {
        return
    }            

    do {
       try FIRAuth.auth()?.signOut()
       FBSDKAccessToken.setCurrent(nil)
       loggedIn = false
       storedValuesData.setValue(nil, forKey: "savedLoginEmail")
       storedValuesData.setValue(nil, forKey: "savedLoginPassword")
       jumpToVC1()
    } catch let error as NSError {
        print(error.localizedDescription)
    }
}

https://stackoverflow.com/a/40107017

google 의 예시

Try adding GIDSignIn.sharedInstance().signOut() for signout

firebase auth와 facebook, google oauth를 이용 사용자의 접속을 관리하는 경우. 사용자가 sign out작업을 하면 두단계로 이를 처리한다. 우선 firebase auth 단계에서 처리하고 각각 google, facebook에서도 개별 처리해주어야 한다.

https://stackoverflow.com/a/42002262

facebook의 예시

You don’t need completion blocks, as the method is synchronous.

@IBAction func logOut(_ sender: UIButton) {
    guard FIRAuth.auth()?.currentUser != nil else {
        return
    }            

    do {
       try FIRAuth.auth()?.signOut()
       FBSDKAccessToken.setCurrent(nil)
       loggedIn = false
       storedValuesData.setValue(nil, forKey: "savedLoginEmail")
       storedValuesData.setValue(nil, forKey: "savedLoginPassword")
       jumpToVC1()
    } catch let error as NSError {
        print(error.localizedDescription)
    }
}

https://stackoverflow.com/a/40107017

google 의 예시

Try adding GIDSignIn.sharedInstance().signOut() for signout

How to set cell spacing and UICollectionView – UICollectionViewFlowLayout size ratio?

How to set cell spacing and UICollectionView – UICollectionViewFlowLayout size ratio?

Is there a way to get line number and function name in Swift language?