123456789101112131415161718192021222324252627282930313233343536373839404142 |
- //
- // TSToastTool.swift
- // TSLiveWallpaper
- //
- // Created by 100Years on 2024/12/20.
- //
- import SVProgressHUD
- let TSToastShared = TSToastTool.shared
- class TSToastTool {
- static let shared = TSToastTool()
- private init() {
- SVProgressHUD.setDefaultStyle(.dark)
- //如果您想要堆叠 HUD,您可以使用以下方法平衡每个节目通话:
- //[SVProgressHUD popActivity];
- }
- /// 显示文字提示
- func showToast(text: String, duration: TimeInterval = 3.0) {
- kExecuteOnMainThread {
- SVProgressHUD.showInfo(withStatus: text)
- }
- }
- /// 显示加载动画
- func showLoading(text:String? = nil) {
- kExecuteOnMainThread {
- SVProgressHUD.show(withStatus: text)
- }
- }
- /// 隐藏加载动画
- func hideLoading() {
- kExecuteOnMainThread {
- SVProgressHUD.dismiss()
- }
- }
- }
|