Skip to content

Commit 8ebb3b2

Browse files
committed
13.8.3
1 parent 97dd7da commit 8ebb3b2

File tree

7 files changed

+58
-160
lines changed

7 files changed

+58
-160
lines changed

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 = '13.8.2'
3+
s.version = '13.8.3'
44
s.license = 'MIT'
55

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

ProgressHUD/Sources/ProgressHUD+Enums.swift

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1010
// THE SOFTWARE.
1111

12-
import UIKit
12+
import Foundation
1313

1414
// MARK: - AnimationType
1515
public enum AnimationType: CaseIterable {
@@ -33,52 +33,3 @@ public enum AnimatedIcon {
3333
case failed
3434
case added
3535
}
36-
37-
// MARK: - AlertIcon
38-
public enum AlertIcon: CaseIterable {
39-
case heart
40-
case doc
41-
case bookmark
42-
case moon
43-
case star
44-
case exclamation
45-
case flag
46-
case message
47-
case question
48-
case bolt
49-
case shuffle
50-
case eject
51-
case card
52-
case rotate
53-
case like
54-
case dislike
55-
case privacy
56-
case cart
57-
case search
58-
}
59-
60-
extension AlertIcon {
61-
var image: UIImage? {
62-
switch self {
63-
case .heart: return UIImage(systemName: "heart.fill")
64-
case .doc: return UIImage(systemName: "doc.fill")
65-
case .bookmark: return UIImage(systemName: "bookmark.fill")
66-
case .moon: return UIImage(systemName: "moon.fill")
67-
case .star: return UIImage(systemName: "star.fill")
68-
case .exclamation: return UIImage(systemName: "exclamationmark.triangle.fill")
69-
case .flag: return UIImage(systemName: "flag.fill")
70-
case .message: return UIImage(systemName: "envelope.fill")
71-
case .question: return UIImage(systemName: "questionmark.diamond.fill")
72-
case .bolt: return UIImage(systemName: "bolt.fill")
73-
case .shuffle: return UIImage(systemName: "shuffle")
74-
case .eject: return UIImage(systemName: "eject.fill")
75-
case .card: return UIImage(systemName: "creditcard.fill")
76-
case .rotate: return UIImage(systemName: "rotate.right.fill")
77-
case .like: return UIImage(systemName: "hand.thumbsup.fill")
78-
case .dislike: return UIImage(systemName: "hand.thumbsdown.fill")
79-
case .privacy: return UIImage(systemName: "hand.raised.fill")
80-
case .cart: return UIImage(systemName: "cart.fill")
81-
case .search: return UIImage(systemName: "magnifyingglass")
82-
}
83-
}
84-
}

ProgressHUD/Sources/ProgressHUD+Public.swift

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -163,17 +163,11 @@ public extension ProgressHUD {
163163
// MARK: - Static Image
164164
public extension ProgressHUD {
165165

166-
class func show(_ text: String? = nil, icon: AlertIcon, interaction: Bool = true, delay: TimeInterval? = nil) {
167-
DispatchQueue.main.async {
168-
let image = icon.image?.withTintColor(shared.colorAnimation, renderingMode: .alwaysOriginal)
169-
shared.setup(text: text, staticImage: image, interaction: interaction, delay: delay)
170-
}
171-
}
172-
173166
class func show(_ text: String? = nil, symbol: String, interaction: Bool = true, delay: TimeInterval? = nil) {
174167
DispatchQueue.main.async {
175-
let image = UIImage(systemName: symbol)?.withTintColor(shared.colorAnimation, renderingMode: .alwaysOriginal)
176-
shared.setup(text: text, staticImage: image, interaction: interaction, delay: delay)
168+
let image = UIImage(systemName: symbol) ?? UIImage(systemName: "questionmark")
169+
let colored = image?.withTintColor(shared.colorAnimation, renderingMode: .alwaysOriginal)
170+
shared.setup(text: text, staticImage: colored, interaction: interaction, delay: delay)
177171
}
178172
}
179173

ProgressHUD/app.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@
337337
INFOPLIST_FILE = app/Info.plist;
338338
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
339339
LD_RUNPATH_SEARCH_PATHS = "$(inherited)";
340-
MARKETING_VERSION = 13.8.2;
340+
MARKETING_VERSION = 13.8.3;
341341
PRODUCT_BUNDLE_IDENTIFIER = com.relatedcode.progresshud;
342342
PRODUCT_NAME = "$(TARGET_NAME)";
343343
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -367,7 +367,7 @@
367367
INFOPLIST_FILE = app/Info.plist;
368368
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
369369
LD_RUNPATH_SEARCH_PATHS = "$(inherited)";
370-
MARKETING_VERSION = 13.8.2;
370+
MARKETING_VERSION = 13.8.3;
371371
PRODUCT_BUNDLE_IDENTIFIER = com.relatedcode.progresshud;
372372
PRODUCT_NAME = "$(TARGET_NAME)";
373373
PROVISIONING_PROFILE_SPECIFIER = "";

ProgressHUD/app/ViewController.swift

Lines changed: 44 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -31,40 +31,13 @@ extension AnimationType {
3131
}
3232
}
3333

34-
// MARK: - AlertIcon
35-
extension AlertIcon {
36-
var text: String {
37-
switch self {
38-
case .heart: return "Heart"
39-
case .doc: return "Doc"
40-
case .bookmark: return "Bookmark"
41-
case .moon: return "Moon"
42-
case .star: return "Star"
43-
case .exclamation: return "Exclamation"
44-
case .flag: return "Flag"
45-
case .message: return "Message"
46-
case .question: return "Question"
47-
case .bolt: return "Bolt"
48-
case .shuffle: return "Shuffle"
49-
case .eject: return "Eject"
50-
case .card: return "Card"
51-
case .rotate: return "Rotate"
52-
case .like: return "Like"
53-
case .dislike: return "Dislike"
54-
case .privacy: return "Privacy"
55-
case .cart: return "Cart"
56-
case .search: return "Search"
57-
}
58-
}
59-
}
60-
6134
// MARK: - ViewController
6235
class ViewController: UITableViewController {
6336

6437
@IBOutlet var cellText: UITableViewCell!
6538

6639
var animations = AnimationType.allCases
67-
var alerticons = AlertIcon.allCases
40+
var symbols: [String] = []
6841

6942
var actions1: [String] = []
7043
var actions2: [String] = []
@@ -92,6 +65,10 @@ class ViewController: UITableViewController {
9265
super.viewDidLoad()
9366
title = "ProgressHUD"
9467

68+
DispatchQueue.main.async {
69+
self.loadSymbols()
70+
}
71+
9572
actions1.append("Animation - No text")
9673
actions1.append("Animation - Short text")
9774
actions1.append("Animation - Longer text")
@@ -105,6 +82,8 @@ class ViewController: UITableViewController {
10582
actions3.append("Progress - 60%")
10683
actions3.append("Progress - 90%")
10784

85+
actions4.append("Symbol - No text")
86+
actions4.append("Symbol - Short text")
10887
actions4.append("Success - No text")
10988
actions4.append("Success - Short text")
11089
actions4.append("Error - No text")
@@ -158,7 +137,7 @@ extension ViewController {
158137
extension ViewController {
159138

160139
override func numberOfSections(in tableView: UITableView) -> Int {
161-
return 9
140+
return 8
162141
}
163142

164143
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
@@ -171,32 +150,30 @@ extension ViewController {
171150
if (section == 5) { return actions3.count }
172151
if (section == 6) { return actions4.count }
173152
if (section == 7) { return actions5.count }
174-
if (section == 8) { return alerticons.count }
175153

176154
return 0
177155
}
178156

179157
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
180-
if (indexPath.section == 0) && (indexPath.row == 0) { return self.tableView(tableView, cellWithText: "Show Banner") }
181-
if (indexPath.section == 0) && (indexPath.row == 1) { return self.tableView(tableView, cellWithText: "Hide Banner") }
182-
183-
if (indexPath.section == 1) && (indexPath.row == 0) { return cellText }
184-
if (indexPath.section == 1) && (indexPath.row == 1) { return self.tableView(tableView, cellWithText: "Dismiss Keyboard") }
185-
if (indexPath.section == 1) && (indexPath.row == 2) { return self.tableView(tableView, cellWithText: "Dismiss HUD") }
186-
if (indexPath.section == 1) && (indexPath.row == 3) { return self.tableView(tableView, cellWithText: "Remove HUD") }
187-
188-
if (indexPath.section == 2) { return self.tableView(tableView, cellWithText: animations[indexPath.row].text) }
189-
if (indexPath.section == 3) { return self.tableView(tableView, cellWithText: actions1[indexPath.row]) }
190-
if (indexPath.section == 4) { return self.tableView(tableView, cellWithText: actions2[indexPath.row]) }
191-
if (indexPath.section == 5) { return self.tableView(tableView, cellWithText: actions3[indexPath.row]) }
192-
if (indexPath.section == 6) { return self.tableView(tableView, cellWithText: actions4[indexPath.row]) }
193-
if (indexPath.section == 7) { return self.tableView(tableView, cellWithText: actions5[indexPath.row]) }
194-
if (indexPath.section == 8) { return self.tableView(tableView, cellWithText: alerticons[indexPath.row].text) }
158+
if (indexPath.section == 0) && (indexPath.row == 0) { return cellWithText(tableView, "Show Banner") }
159+
if (indexPath.section == 0) && (indexPath.row == 1) { return cellWithText(tableView, "Hide Banner") }
160+
161+
if (indexPath.section == 1) && (indexPath.row == 0) { return cellText }
162+
if (indexPath.section == 1) && (indexPath.row == 1) { return cellWithText(tableView, "Dismiss Keyboard") }
163+
if (indexPath.section == 1) && (indexPath.row == 2) { return cellWithText(tableView, "Dismiss HUD") }
164+
if (indexPath.section == 1) && (indexPath.row == 3) { return cellWithText(tableView, "Remove HUD") }
165+
166+
if (indexPath.section == 2) { return cellWithText(tableView, animations[indexPath.row].text) }
167+
if (indexPath.section == 3) { return cellWithText(tableView, actions1[indexPath.row]) }
168+
if (indexPath.section == 4) { return cellWithText(tableView, actions2[indexPath.row]) }
169+
if (indexPath.section == 5) { return cellWithText(tableView, actions3[indexPath.row]) }
170+
if (indexPath.section == 6) { return cellWithText(tableView, actions4[indexPath.row]) }
171+
if (indexPath.section == 7) { return cellWithText(tableView, actions5[indexPath.row]) }
195172

196173
return UITableViewCell()
197174
}
198175

199-
func tableView(_ tableView: UITableView, cellWithText text: String) -> UITableViewCell {
176+
func cellWithText(_ tableView: UITableView, _ text: String) -> UITableViewCell {
200177
var cell: UITableViewCell! = tableView.dequeueReusableCell(withIdentifier: "cell")
201178
if (cell == nil) { cell = UITableViewCell(style: .default, reuseIdentifier: "cell") }
202179
cell.textLabel?.text = text
@@ -212,7 +189,6 @@ extension ViewController {
212189
if (section == 5) { return "Progress" }
213190
if (section == 6) { return "Action - Static" }
214191
if (section == 7) { return "Action - Animated" }
215-
if (section == 8) { return "Alert Icons" }
216192
return nil
217193
}
218194
}
@@ -259,10 +235,12 @@ extension ViewController {
259235
}
260236

261237
if (indexPath.section == 6) {
262-
if (indexPath.row == 0) { ProgressHUD.showSuccess() }
263-
if (indexPath.row == 1) { ProgressHUD.showSuccess(textSuccess) }
264-
if (indexPath.row == 2) { ProgressHUD.showError() }
265-
if (indexPath.row == 3) { ProgressHUD.showError(textError) }
238+
if (indexPath.row == 0) { ProgressHUD.show(symbol: symbol()) }
239+
if (indexPath.row == 1) { ProgressHUD.show(textAdded, symbol: symbol()) }
240+
if (indexPath.row == 2) { ProgressHUD.showSuccess() }
241+
if (indexPath.row == 3) { ProgressHUD.showSuccess(textSuccess) }
242+
if (indexPath.row == 4) { ProgressHUD.showError() }
243+
if (indexPath.row == 5) { ProgressHUD.showError(textError) }
266244
}
267245

268246
if (indexPath.section == 7) {
@@ -273,21 +251,26 @@ extension ViewController {
273251
if (indexPath.row == 4) { ProgressHUD.showAdded() }
274252
if (indexPath.row == 5) { ProgressHUD.showAdded(textAdded) }
275253
}
276-
277-
if (indexPath.section == 8) {
278-
let alerticon = alerticons[indexPath.row]
279-
ProgressHUD.show(randomText(), icon: alerticon)
280-
}
281254
}
282255
}
283256

284-
// MARK: - Text Methods
257+
// MARK: - Helper Methods
285258
extension ViewController {
286259

287-
func randomText() -> String? {
288-
let array = [textShort, textLong, textSucceed, textFailed, textAdded, nil]
289-
let index = Int.random(in: 0..<array.count)
290-
return array[index]
260+
func loadSymbols() {
261+
if let bundle = Bundle(identifier: "com.apple.CoreGlyphs") {
262+
if let path = bundle.path(forResource: "symbol_search", ofType: "plist") {
263+
if let temp = NSDictionary(contentsOfFile: path) {
264+
if let values = temp as? [String: [String]] {
265+
symbols = Array(values.keys)
266+
}
267+
}
268+
}
269+
}
270+
}
271+
272+
func symbol() -> String {
273+
symbols.randomElement() ?? "questionmark"
291274
}
292275

293276
func toggleText() -> String {

README.md

Lines changed: 6 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
## WHAT'S NEW
44

5+
### Version: 13.8.3
6+
7+
- Removed the `AlertIcon` feature. Please use the `symbol:` parameter for similar functionality.
8+
- The `questionmark` symbol will be displayed when the specified symbol name does not exist.
9+
510
### Version: 13.8.2
611

712
- Refactored internal code architecture.
@@ -122,14 +127,6 @@ ProgressHUD.showProgress(0.15)
122127
ProgressHUD.showProgress("Loading...", 0.42)
123128
```
124129

125-
```swift
126-
ProgressHUD.show(icon: .heart)
127-
```
128-
129-
```swift
130-
ProgressHUD.show("Some text...", icon: .privacy, delay: 2.0)
131-
```
132-
133130
```swift
134131
ProgressHUD.show(symbol: "box.truck")
135132
```
@@ -189,13 +186,10 @@ ProgressHUD.fontStatus = .boldSystemFont(ofSize: 24)
189186

190187
```swift
191188
ProgressHUD.imageSuccess = UIImage(named: "success.png")
192-
```
193-
194-
```swift
195189
ProgressHUD.imageError = UIImage(named: "error.png")
196190
```
197191

198-
A comprehensive list of the predefined animation and icon types:
192+
A comprehensive list of the predefined animation types:
199193

200194
```swift
201195
public enum AnimationType {
@@ -222,30 +216,6 @@ public enum AnimatedIcon {
222216
}
223217
```
224218

225-
```swift
226-
public enum AlertIcon {
227-
case heart
228-
case doc
229-
case bookmark
230-
case moon
231-
case star
232-
case exclamation
233-
case flag
234-
case message
235-
case question
236-
case bolt
237-
case shuffle
238-
case eject
239-
case card
240-
case rotate
241-
case like
242-
case dislike
243-
case privacy
244-
case cart
245-
case search
246-
}
247-
```
248-
249219
## LICENSE
250220

251221
MIT License

VERSION.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
13.8.2
1+
13.8.3

0 commit comments

Comments
 (0)