Authentication

public struct Authentication
extension Authentication: View
extension Authentication: _ViewEmptyChecking

Authentication is used to display a login screen with customizable detail image, title, subtitle, input fields and sign-in action.

Usage

// Basic usage
@State var password: String = ""
@State var name: String = ""

Authentication(detailImage: {
    Image(.illustration).resizable().aspectRatio(contentMode: .fit)
}, title: {
    Text("Authentication")
}, subtitle: {
    Text("Please provide your username and password to authenticate.")
}, authInput: {
    VStack(spacing: 16) {
        TextFieldFormView(title: "", text: self.$name, placeholder: "Enter your name")
        TextFieldFormView(title: "", text: self.$password, isSecureEnabled: true, placeholder: "Enter your password")
    }
}, isDisabled: password.isEmpty || name.isEmpty) {
    print("sign in ......")
}

// With banner message and custom style
Authentication(detailImage: {
    Image(.illustration).resizable().aspectRatio(contentMode: .fit)
}, title: {
    Text("Authentication")
}, subtitle: {
    Text("Please provide your username and password.")
}, isDisabled: password.isEmpty || name.isEmpty) {
    // Handle sign in action
}
.authenticationStyle(BasicAuthenticationStyle(password: self.$password, name: self.$name))
.bannerMessageView(isPresented: self.$isPresentedBanner,
                  pushContentDown: .constant(false),
                  icon: { EmptyView() },
                  title: "Verifying...",
                  messageType: .neutral)