ToastPluginImpl

@MainActor
open class ToastPluginImpl : NSObject, ToastPlugin, @unchecked Sendable

默认吐司插件

Accessor

  • 单例模式

    Declaration

    Swift

    @objc(sharedInstance)
    @MainActor
    public static let shared: ToastPluginImpl
  • 显示吐司时是否执行淡入动画,默认YES

    Declaration

    Swift

    @MainActor
    open var fadeAnimated: Bool
  • 加载吐司延迟隐藏时间,默认0.1

    Declaration

    Swift

    @MainActor
    open var delayHideTime: TimeInterval
  • 消息吐司自动隐藏时间句柄,默认nil时为2.0

    Declaration

    Swift

    @MainActor
    open var autoHideTime: (@MainActor @Sendable (ToastStyle) -> TimeInterval)?
  • 自定义吐司视图句柄,默认nil时自动处理,loading时为indicator,progress时为progress,其它为image

    Declaration

    Swift

    @MainActor
    open var customToastView: (@MainActor @Sendable (ToastStyle) -> ToastView?)?
  • 自定义吐司容器句柄,style仅为loading|progress|default,默认nil时使用view

    Declaration

    Swift

    @MainActor
    open var customToastContainer: (@MainActor @Sendable (_ style: ToastStyle, _ view: UIView) -> UIView?)?
  • 吐司自定义句柄,show方法自动调用

    Declaration

    Swift

    @MainActor
    open var customBlock: (@MainActor @Sendable (ToastView) -> Void)?
  • 吐司重用句柄,show方法重用时自动调用

    Declaration

    Swift

    @MainActor
    open var reuseBlock: (@MainActor @Sendable (ToastView) -> Void)?
  • 默认加载吐司文本句柄

    Declaration

    Swift

    @MainActor
    open var defaultLoadingText: (@MainActor @Sendable () -> NSAttributedString?)?
  • 默认加载吐司详情句柄

    Declaration

    Swift

    @MainActor
    open var defaultLoadingDetail: (@MainActor @Sendable () -> NSAttributedString?)?
  • 默认进度条吐司文本句柄

    Declaration

    Swift

    @MainActor
    open var defaultProgressText: (@MainActor @Sendable () -> NSAttributedString?)?
  • 默认进度条吐司详情句柄

    Declaration

    Swift

    @MainActor
    open var defaultProgressDetail: (@MainActor @Sendable () -> NSAttributedString?)?
  • 默认消息吐司文本句柄

    Declaration

    Swift

    @MainActor
    open var defaultMessageText: (@MainActor @Sendable (ToastStyle) -> NSAttributedString?)?
  • 默认消息吐司详情句柄

    Declaration

    Swift

    @MainActor
    open var defaultMessageDetail: (@MainActor @Sendable (ToastStyle) -> NSAttributedString?)?
  • 错误消息吐司文本格式化句柄,error生效,默认nil

    Declaration

    Swift

    @MainActor
    open var errorTextFormatter: (@MainActor @Sendable (Error?) -> AttributedStringParameter?)?
  • 错误消息吐司详情格式化句柄,error生效,默认nil

    Declaration

    Swift

    @MainActor
    open var errorDetailFormatter: (@MainActor @Sendable (Error?) -> AttributedStringParameter?)?
  • 错误消息吐司样式格式化句柄,error生效,默认nil

    Declaration

    Swift

    @MainActor
    open var errorStyleFormatter: (@MainActor @Sendable (Error?) -> ToastStyle)?

ToastPlugin