ErrorAlertViewModel

public struct ErrorAlertViewModel

ErrorAlertViewModel models a UIAlertController used to report and error alert.

  • 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 dismiss button action.

    Declaration

    Swift

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

    Declaration

    Swift

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

    Parameters

    title

    The alert title.

    message

    The alert message.

    dismissButtonTitle

    The dismiss button title.

    dismissAction

    The dismiss button action.

  • Default title key for dismiss button. It will fetch the localized value from the corresponding 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