Skip to content

Commit 5a7e1ba

Browse files
committed
14.1.0
1 parent d0f7e5d commit 5a7e1ba

File tree

12 files changed

+249
-155
lines changed

12 files changed

+249
-155
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# Change Log
22

3+
## [14.1.0](https://github.com/relatedcode/ProgressHUD/releases/tag/14.1.0)
4+
5+
Released on 2023-10-15.
6+
7+
#### Changed
8+
9+
- Renamed the `AnimatedIcon` enum to `LiveIcon`.
10+
- The general `show` method has been split into multiple specialized methods: `animate`, `progress`, `liveIcon`, `image`, `symbol`.
11+
- Updated the Static Image SF Symbol weight configuration to utilize a bold setting.
12+
- Conducted minor code improvements for better maintainability and performance.
13+
314
## [14.0.0](https://github.com/relatedcode/ProgressHUD/releases/tag/14.0.0)
415

516
Released on 2023-10-14.

ProgressHUD.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'ProgressHUD'
3-
s.version = '14.0.0'
3+
s.version = '14.1.0'
44
s.license = 'MIT'
55

66
s.summary = 'A lightweight and easy-to-use Progress HUD for iOS.'

ProgressHUD/Sources/Animations/ProgressHUD+SFSymbolBounce.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ extension ProgressHUD {
1919
let height = view.frame.height
2020

2121
let image = UIImage(systemName: animationSymbol) ?? UIImage(systemName: "questionmark")
22+
let config = UIImage.SymbolConfiguration(weight: .bold)
2223

2324
let imageView = UIImageView(frame: CGRect(x: 0, y: 0, width: width, height: height))
24-
let configuration = UIImage.SymbolConfiguration(weight: .bold)
25-
imageView.image = image?.applyingSymbolConfiguration(configuration)
25+
imageView.image = image?.applyingSymbolConfiguration(config)
2626
imageView.tintColor = colorAnimation
2727
imageView.contentMode = .scaleAspectFit
2828

ProgressHUD/Sources/ProgressHUD+Enums.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ public enum AnimationType: CaseIterable {
3737
case triangleDotShift
3838
}
3939

40-
// MARK: - AnimatedIcon
41-
public enum AnimatedIcon {
40+
// MARK: - LiveIcon
41+
public enum LiveIcon {
4242
case succeed
4343
case failed
4444
case added

ProgressHUD/Sources/ProgressHUD+AnimatedIcon.swift renamed to ProgressHUD/Sources/ProgressHUD+LiveIcon.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111

1212
import UIKit
1313

14-
// MARK: - Succeed
14+
// MARK: - Live Icon Succeed
1515
extension ProgressHUD {
1616

17-
func animatedIconSucceed(_ view: UIView) {
17+
func liveIconSucceed(_ view: UIView) {
1818
let length = view.frame.width
1919
let delay = (alpha == 0) ? 0.25 : 0.0
2020

@@ -45,10 +45,10 @@ extension ProgressHUD {
4545
}
4646
}
4747

48-
// MARK: - Failed
48+
// MARK: - Live Icon Failed
4949
extension ProgressHUD {
5050

51-
func animatedIconFailed(_ view: UIView) {
51+
func liveIconFailed(_ view: UIView) {
5252
let length = view.frame.width
5353
let delay = (alpha == 0) ? 0.25 : 0.0
5454

@@ -88,10 +88,10 @@ extension ProgressHUD {
8888
}
8989
}
9090

91-
// MARK: - Added
91+
// MARK: - Live Icon Added
9292
extension ProgressHUD {
9393

94-
func animatedIconAdded(_ view: UIView) {
94+
func liveIconAdded(_ view: UIView) {
9595
let length = view.frame.width
9696
let delay = (alpha == 0) ? 0.25 : 0.0
9797

ProgressHUD/Sources/ProgressHUD+Public.swift

Lines changed: 58 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public extension ProgressHUD {
109109
}
110110
}
111111

112-
// MARK: - HUD General
112+
// MARK: - HUD Removal
113113
public 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
135145
public 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
169179
public 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
199217
public 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
215242
public 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

Comments
 (0)