AI-generated Key Takeaways
-
GoogleSignInButton is a SwiftUI struct used for a Google Sign In button.
-
The button can be initialized using a
viewModelor by specifyingscheme,style, andstate. -
The
viewModelcontains styling information for the button. -
The
actionparameter is a closure that defines what happens when the button is pressed.
GoogleSignInButton
@available(iOS 13.0, macOS 10.15, *)
public struct GoogleSignInButton : ViewA Google Sign In button to be used in SwiftUI.
-
An object containing the styling information needed to create the button.
Declaration
Swift
@ObservedObject public var viewModel: GoogleSignInButtonViewModel { get set } -
Creates an instance of the Google Sign-In button for use in SwiftUI
Seealso
Refer toGoogleSignInButtonViewModel.swiftfor its defaults.Declaration
Swift
public init( viewModel: GoogleSignInButtonViewModel = GoogleSignInButtonViewModel(), action: @escaping () -> Void )Parameters
viewModelAn instance of
GoogleSignInButtonViewModelcontaining information on the button’s scheme, style, and state. Defaults toGoogleSignInButtonViewModelwith its standard defaults.actionA closure to use as the button’s action upon press.
-
A convenience initializer to create a Google Sign-In button in SwiftUI with scheme, style, and state.
Declaration
Swift
public init( scheme: GoogleSignInButtonColorScheme = .light, style: GoogleSignInButtonStyle = .standard, state: GoogleSignInButtonState = .normal, action: @escaping () -> Void )Parameters
schemeThe
GoogleSignInButtonColorSchemeto use. Defaults to.light.styleThe
GoogleSignInButtonStyleto use. Defaults to.standard.stateThe
GoogleSignInButtonStateto use. Defaults to.normal.actionA closure to use as the button’s action upon press.
-
Declaration
Swift
public var body: some View { get }