AlertAppearance

public class AlertAppearance : NSObject, @unchecked Sendable

系统弹出框样式配置类,由于系统兼容性,建议优先使用AlertController

备注:如果未自定义样式,显示效果和系统一致,不会产生任何影响;框架会先渲染actions动作再渲染cancel动作

  • 单例模式,统一设置样式

    Declaration

    Swift

    public static let appearance: AlertAppearance
  • 自定义首选动作句柄,默认nil,跟随系统

    Declaration

    Swift

    public var preferredActionBlock: (@MainActor @Sendable (_ alertController: UIAlertController) -> UIAlertAction?)?
  • 标题颜色,仅全局生效,默认nil

    Declaration

    Swift

    public var titleColor: UIColor?
  • 标题字体,仅全局生效,默认nil

    Declaration

    Swift

    public var titleFont: UIFont?
  • 消息颜色,仅全局生效,默认nil

    Declaration

    Swift

    public var messageColor: UIColor?
  • 消息字体,仅全局生效,默认nil

    Declaration

    Swift

    public var messageFont: UIFont?
  • 默认动作颜色,仅全局生效,默认nil

    Declaration

    Swift

    public var actionColor: UIColor?
  • 首选动作颜色,仅全局生效,默认nil

    Declaration

    Swift

    public var preferredActionColor: UIColor?
  • 取消动作颜色,仅全局生效,默认nil

    Declaration

    Swift

    public var cancelActionColor: UIColor?
  • 警告动作颜色,仅全局生效,默认nil

    Declaration

    Swift

    public var destructiveActionColor: UIColor?
  • 禁用动作颜色,仅全局生效,默认nil

    Declaration

    Swift

    public var disabledActionColor: UIColor?
  • 是否启用Controller样式,设置后自动启用

    Declaration

    Swift

    public var controllerEnabled: Bool { get }
  • 是否启用Action样式,设置后自动启用

    Declaration

    Swift

    public var actionEnabled: Bool { get }