ConfirmationAlertViewModel

public struct ConfirmationAlertViewModel

ConfirmationAlertViewModel models a UIAlertController that can be confirmed or dismissed.

  • The alert title.

    Declaration

    Swift

    public let title: String?
  • The alert message.

    Declaration

    Swift

    public let message: String?
  • The dismiss button title.

    Declaration

    Swift

    public let dismissButtonTitle: String
  • The confirm button title.

    Declaration

    Swift

    public let confirmButtonTitle: String
  • The dismiss button action.

    Declaration

    Swift

    public let dismissAction: (ConfirmationAlertViewModel) -> Void
  • The confirm button action.

    Declaration

    Swift

    public let confirmAction: (ConfirmationAlertViewModel) -> Void
  • Initialize a new ConfirmationAlertViewModel with the provided parameters.

    Declaration

    Swift

    public init(
        title: String? = "",
        message: String? = .none,
        dismissButtonTitle: String = DefaultDismissButtonTitleKey.localized(),
        dismissAction: @escaping (ConfirmationAlertViewModel) -> Void = { _ in },
        confirmButtonTitle: String = DefaultConfirmButtonTitleKey.localized(),
        confirmAction: @escaping (ConfirmationAlertViewModel) -> Void = { _ in })

    Parameters

    title

    The alert title.

    message

    The alert message.

    dismissButtonTitle

    The dismiss button title.

    dismissAction

    The dismiss button action.

    confirmButtonTitle

    The confirm button title.

    confirmAction

    The confirm button action.

  • Default title key for confirm button. It will fetch the localized value from the Localizable.strings file in the main bundle. So you’ll have to add this key and give it a value in your Localizable.strings file. You can provide a different key by changing this property.

    Seealso

    Localizable.String

    Declaration

    Swift

    public static var DefaultConfirmButtonTitleKey: String
  • Default title key for dismiss button. It will fetch the localized value from the Localizable.strings file in the main bundle. So you’ll have to add this key and give it a value in your Localizable.strings file. You can provide a different key by changing this property.

    Seealso

    Localizable.String

    Declaration

    Swift

    public static var DefaultDismissButtonTitleKey: String