Files
real-e-party-iOS/YuMi/E-P/Common/EPProgressHUD.swift
edwinQQQ 7626eb8351 feat: 添加动态发布功能及相关文档
主要变更:
1. 新增 EPImageUploader.swift 和 EPProgressHUD.swift,提供图片批量上传和进度显示功能。
2. 新建 EPMomentAPISwiftHelper.swift,封装动态 API 的 Swift 版本。
3. 更新 EPMomentPublishViewController,集成新上传功能并实现发布成功通知。
4. 创建多个文档,包括实施报告、检查清单和快速使用指南,详细记录功能实现和使用方法。
5. 更新 Bridging Header,确保 Swift 和 Objective-C 代码的互操作性。

此功能旨在提升用户体验,简化动态发布流程,并提供清晰的文档支持。
2025-10-11 17:16:30 +08:00

52 lines
1.5 KiB
Swift
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// EPProgressHUD.swift
// YuMi
//
// Created by AI on 2025-10-11.
//
import UIKit
import Foundation
/// Loading MBProgressHUD
@objc class EPProgressHUD: NSObject {
private static var currentHUD: MBProgressHUD?
///
/// - Parameters:
/// - uploaded:
/// - total:
@objc static func showProgress(_ uploaded: Int, total: Int) {
DispatchQueue.main.async {
guard let window = UIApplication.shared.keyWindow else { return }
if let hud = currentHUD {
// HUD
hud.label.text = "上传中 \(uploaded)/\(total)"
hud.progress = Float(uploaded) / Float(total)
} else {
// HUD
let hud = MBProgressHUD.showAdded(to: window, animated: true)
hud.mode = .determinateHorizontalBar
hud.label.text = "上传中 \(uploaded)/\(total)"
hud.progress = Float(uploaded) / Float(total)
hud.removeFromSuperViewOnHide = true
currentHUD = hud
}
}
}
/// HUD
@objc static func dismiss() {
DispatchQueue.main.async {
guard let window = UIApplication.shared.keyWindow,
let hud = currentHUD else { return }
hud.hide(animated: true)
currentHUD = nil
}
}
}