Skip to content

Instantly share code, notes, and snippets.

@mspvirajpatel
Created June 15, 2020 13:04
Show Gist options
  • Save mspvirajpatel/ff334fea37061bcf617783095dcefdf5 to your computer and use it in GitHub Desktop.
Save mspvirajpatel/ff334fea37061bcf617783095dcefdf5 to your computer and use it in GitHub Desktop.
public struct LoginUserData {
public var userId: String? = ""
public var userName: String? = ""
public var email: String? = ""
public var gender: Int = 0
public var birthday: String? = ""
public var about: String? = ""
public var photoUrl: String? = ""
public var idToken: String? = ""
public var accessToken: String? = ""
}
@mspvirajpatel
Copy link
Author

   public typealias UserDataComplition = (_ userData: LoginUserData?, _ error: Error?) -> Void

var userDataBlock: UserDataComplition?

public func login(controller: UIViewController, complitionBlock: @escaping UserDataComplition, didDisconnectBlock: @escaping UserDataComplition) {
userDataBlock = complitionBlock
userDidDisconnectWithBlock = didDisconnectBlock
googleManager?.presentingViewController = controller
googleManager?.delegate = self
googleManager?.signIn()
}

userData = data
if let block = self.userDataBlock {
block(data, nil)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment