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)
-
Undocumented
Declaration
Swift
public init(@ViewBuilder detailImage: () -> any View = { EmptyView() }, @ViewBuilder title: () -> any View, @ViewBuilder subtitle: () -> any View = { EmptyView() }, @ViewBuilder authInput: () -> any View = { EmptyView() }, @ViewBuilder signInAction: () -> any View = { FioriButton { _ in Text("Sign In".localizedFioriString()) } }, isDisabled: Bool, didSignIn: (() -> Void)? = nil, componentIdentifier: String? = Authentication.identifier)
-
Undocumented
Declaration
Swift
static let identifier: String
-
Undocumented
Declaration
Swift
init(detailImage: Image? = nil, title: AttributedString, subtitle: AttributedString? = nil, @ViewBuilder authInput: () -> any View = { EmptyView() }, signInAction: FioriButton? = FioriButton { _ in Text("Sign In".localizedFioriString()) }, isDisabled: Bool, didSignIn: (() -> Void)? = nil)
-
Undocumented
Declaration
Swift
init(_ configuration: AuthenticationConfiguration)
-
Declaration
Swift
@MainActor public var body: some View { get }
-
Undocumented
Declaration
Swift
public var isEmpty: Bool { get }