@@ -109,7 +109,7 @@ public extension ProgressHUD {
109109 }
110110}
111111
112- // MARK: - HUD General
112+ // MARK: - HUD Removal
113113public extension ProgressHUD {
114114
115115 class func dismiss( ) {
@@ -123,104 +123,131 @@ public extension ProgressHUD {
123123 shared. removeHUD ( )
124124 }
125125 }
126+ }
126127
127- class func show( _ text: String ? = nil , interaction: Bool = true ) {
128+ // MARK: - Progress
129+ public extension ProgressHUD {
130+
131+ class func progress( _ value: CGFloat , interaction: Bool = false ) {
128132 DispatchQueue . main. async {
129- shared. setup ( text: text, interaction: interaction)
133+ shared. progress ( text: nil , value: value, interaction: interaction)
134+ }
135+ }
136+
137+ class func progress( _ text: String ? , _ value: CGFloat , interaction: Bool = false ) {
138+ DispatchQueue . main. async {
139+ shared. progress ( text: text, value: value, interaction: interaction)
130140 }
131141 }
132142}
133143
134- // MARK: - Animated Icon
144+ // MARK: - Live Icon
135145public extension ProgressHUD {
136146
137- class func show ( _ text: String ? = nil , icon: AnimatedIcon , interaction: Bool = true , delay: TimeInterval ? = nil ) {
147+ class func liveIcon ( _ text: String ? = nil , icon: LiveIcon , interaction: Bool = true , delay: TimeInterval ? = nil ) {
138148 DispatchQueue . main. async {
139- shared. setup ( text: text, animatedIcon : icon, interaction: interaction, delay: delay)
149+ shared. liveIcon ( text: text, icon : icon, interaction: interaction, delay: delay)
140150 }
141151 }
142152
143- class func showSucceed ( _ text: String ? = nil , interaction: Bool = true , delay: TimeInterval ? = nil ) {
153+ class func succeed ( _ text: String ? = nil , interaction: Bool = true , delay: TimeInterval ? = nil ) {
144154 DispatchQueue . main. async {
145- shared. setup ( text: text, animatedIcon : . succeed, interaction: interaction, delay: delay)
155+ shared. liveIcon ( text: text, icon : . succeed, interaction: interaction, delay: delay)
146156 }
147157 }
148158
149- class func showFailed ( _ text: String ? = nil , interaction: Bool = true , delay: TimeInterval ? = nil ) {
159+ class func failed ( _ text: String ? = nil , interaction: Bool = true , delay: TimeInterval ? = nil ) {
150160 DispatchQueue . main. async {
151- shared. setup ( text: text, animatedIcon : . failed, interaction: interaction, delay: delay)
161+ shared. liveIcon ( text: text, icon : . failed, interaction: interaction, delay: delay)
152162 }
153163 }
154164
155- class func showFailed ( _ error: Error ? , interaction: Bool = true , delay: TimeInterval ? = nil ) {
165+ class func failed ( _ error: Error ? , interaction: Bool = true , delay: TimeInterval ? = nil ) {
156166 DispatchQueue . main. async {
157- shared. setup ( text: error? . localizedDescription, animatedIcon : . failed, interaction: interaction, delay: delay)
167+ shared. liveIcon ( text: error? . localizedDescription, icon : . failed, interaction: interaction, delay: delay)
158168 }
159169 }
160170
161- class func showAdded ( _ text: String ? = nil , interaction: Bool = true , delay: TimeInterval ? = nil ) {
171+ class func added ( _ text: String ? = nil , interaction: Bool = true , delay: TimeInterval ? = nil ) {
162172 DispatchQueue . main. async {
163- shared. setup ( text: text, animatedIcon : . added, interaction: interaction, delay: delay)
173+ shared. liveIcon ( text: text, icon : . added, interaction: interaction, delay: delay)
164174 }
165175 }
166176}
167177
168178// MARK: - Static Image
169179public extension ProgressHUD {
170180
171- class func show ( _ text: String ? = nil , symbol : String , interaction: Bool = true , delay: TimeInterval ? = nil ) {
181+ class func image ( _ text: String ? = nil , image : UIImage ? , interaction: Bool = true , delay: TimeInterval ? = nil ) {
172182 DispatchQueue . main. async {
173- let image = UIImage ( systemName: symbol) ?? UIImage ( systemName: " questionmark " )
174- let colored = image? . withTintColor ( shared. colorAnimation, renderingMode: . alwaysOriginal)
175- shared. setup ( text: text, staticImage: colored, interaction: interaction, delay: delay)
183+ shared. staticImage ( text: text, image: image, interaction: interaction, delay: delay)
176184 }
177185 }
178186
179- class func showSuccess ( _ text: String ? = nil , image : UIImage ? = nil , interaction: Bool = true , delay: TimeInterval ? = nil ) {
187+ class func symbol ( _ text: String ? = nil , name : String , interaction: Bool = true , delay: TimeInterval ? = nil ) {
180188 DispatchQueue . main. async {
181- shared. setup ( text: text, staticImage: image ?? shared. imageSuccess, interaction: interaction, delay: delay)
189+ let image = UIImage ( systemName: name) ?? UIImage ( systemName: " questionmark " )
190+ let config = UIImage . SymbolConfiguration ( weight: . bold)
191+ let modified = image? . applyingSymbolConfiguration ( config)
192+ let colored = modified? . withTintColor ( colorAnimation, renderingMode: . alwaysOriginal)
193+ shared. staticImage ( text: text, image: colored, interaction: interaction, delay: delay)
182194 }
183195 }
184196
185- class func showError ( _ text: String ? = nil , image: UIImage ? = nil , interaction: Bool = true , delay: TimeInterval ? = nil ) {
197+ class func success ( _ text: String ? = nil , image: UIImage ? = nil , interaction: Bool = true , delay: TimeInterval ? = nil ) {
186198 DispatchQueue . main. async {
187- shared. setup ( text: text, staticImage : image ?? shared . imageError , interaction: interaction, delay: delay)
199+ shared. staticImage ( text: text, image : image ?? imageSuccess , interaction: interaction, delay: delay)
188200 }
189201 }
190202
191- class func showError ( _ error : Error ? , image: UIImage ? = nil , interaction: Bool = true , delay: TimeInterval ? = nil ) {
203+ class func error ( _ text : String ? = nil , image: UIImage ? = nil , interaction: Bool = true , delay: TimeInterval ? = nil ) {
192204 DispatchQueue . main. async {
193- shared. setup ( text: error? . localizedDescription, staticImage: image ?? shared. imageError, interaction: interaction, delay: delay)
205+ shared. staticImage ( text: text, image: image ?? imageError, interaction: interaction, delay: delay)
206+ }
207+ }
208+
209+ class func error( _ error: Error ? , image: UIImage ? = nil , interaction: Bool = true , delay: TimeInterval ? = nil ) {
210+ DispatchQueue . main. async {
211+ shared. staticImage ( text: error? . localizedDescription, image: image ?? imageError, interaction: interaction, delay: delay)
194212 }
195213 }
196214}
197215
198- // MARK: - Progress
216+ // MARK: - Animation
199217public extension ProgressHUD {
200218
201- class func showProgress( _ progress: CGFloat , interaction: Bool = false ) {
219+ class func animate( _ text: String ? = nil , interaction: Bool = true ) {
220+ DispatchQueue . main. async {
221+ shared. animate ( text: text, interaction: interaction)
222+ }
223+ }
224+
225+ class func animate( _ text: String ? = nil , _ type: AnimationType , interaction: Bool = true ) {
202226 DispatchQueue . main. async {
203- shared. setup ( text: nil , progress: progress, interaction: interaction)
227+ animationType = type
228+ shared. animate ( text: text, interaction: interaction)
204229 }
205230 }
206231
207- class func showProgress ( _ text: String ? , _ progress : CGFloat , interaction: Bool = false ) {
232+ class func animate ( _ text: String ? = nil , symbol : String , interaction: Bool = true ) {
208233 DispatchQueue . main. async {
209- shared. setup ( text: text, progress: progress, interaction: interaction)
234+ animationType = . sfSymbolBounce
235+ animationSymbol = symbol
236+ shared. animate ( text: text, interaction: interaction)
210237 }
211238 }
212239}
213240
214241// MARK: - Banner
215242public extension ProgressHUD {
216243
217- class func showBanner ( _ title: String ? , _ message: String ? , delay: TimeInterval = 3.0 ) {
244+ class func banner ( _ title: String ? , _ message: String ? , delay: TimeInterval = 3.0 ) {
218245 DispatchQueue . main. async {
219246 shared. showBanner ( title: title, message: message, delay: delay)
220247 }
221248 }
222249
223- class func hideBanner ( ) {
250+ class func bannerHide ( ) {
224251 DispatchQueue . main. async {
225252 shared. hideBanner ( )
226253 }
0 commit comments