فهرست منبع

Replace indicator style with new ones

onevcat 6 سال پیش
والد
کامیت
71f32f580d
2فایلهای تغییر یافته به همراه25 افزوده شده و 5 حذف شده
  1. 1 1
      Sources/Utility/String+MD5.swift
  2. 24 4
      Sources/Views/Indicator.swift

+ 1 - 1
Sources/Utility/String+MD5.swift

@@ -227,7 +227,7 @@ class MD5: HashProtocol {
 
         for chunk in BytesSequence(chunkSize: chunkSizeBytes, data: tmpMessage) {
             // break chunk into sixteen 32-bit words M[j], 0 ≤ j ≤ 15
-            var M = toUInt32Array(chunk)
+            let M = toUInt32Array(chunk)
             assert(M.count == 16, "Invalid array")
 
             // Initialize hash value for this chunk:

+ 24 - 4
Sources/Views/Indicator.swift

@@ -121,13 +121,21 @@ final class ActivityIndicator: Indicator {
             activityIndicatorView.style = .spinning
         #else
             let indicatorStyle: UIActivityIndicatorView.Style
+
             #if os(tvOS)
-            indicatorStyle = UIActivityIndicatorView.Style.white
-            #elseif targetEnvironment(macCatalyst)
-            indicatorStyle = UIActivityIndicatorView.Style.medium
+            if #available(tvOS 13.0, *) {
+                indicatorStyle = UIActivityIndicatorView.Style.large
+            } else {
+                indicatorStyle = UIActivityIndicatorView.Style.white
+            }
             #else
-            indicatorStyle = UIActivityIndicatorView.Style.gray
+            if #available(iOS 13.0, * ) {
+                indicatorStyle = UIActivityIndicatorView.Style.medium
+            } else {
+                indicatorStyle = UIActivityIndicatorView.Style.gray
+            }
             #endif
+
             #if swift(>=4.2)
             activityIndicatorView = UIActivityIndicatorView(style: indicatorStyle)
             #else
@@ -137,6 +145,18 @@ final class ActivityIndicator: Indicator {
     }
 }
 
+#if canImport(UIKit)
+extension UIActivityIndicatorView.Style {
+    #if compiler(>=5.1)
+    #else
+    static let large = UIActivityIndicatorView.Style.white
+    #if !os(tvOS)
+    static let medium = UIActivityIndicatorView.Style.gray
+    #endif
+    #endif
+}
+#endif
+
 // MARK: - ImageIndicator
 // Displays an ImageView. Supports gif
 final class ImageIndicator: Indicator {