2 İşlemeler c4de98b54d ... 519ccc7c88

Yazar SHA1 Mesaj Tarih
  kln 519ccc7c88 Merge branch 'main' of http://hubgit.cn/zhouzhenshuai/TSSmalCoacopods 1 hafta önce
  kln 356933f589 1 1 hafta önce

+ 1 - 0
TSSmalCoacopods/Classes/Ex/Date+Ex.swift

@@ -39,6 +39,7 @@ public extension Date {
         return dateString
     }
     
+    
     var dateDayString:String {
         let dateFormatter = DateFormatter()
         dateFormatter.dateFormat = "yyyyMMdd"

+ 4 - 0
TSSmalCoacopods/Classes/Ex/NSString+Ex.swift

@@ -14,6 +14,10 @@ public extension String {
         return UIColor.fromHex(self)
     }
     
+    var uiCGColor: CGColor {
+        uiColor.cgColor
+    }
+    
     var localFilePath: String {
         var path = self
         if path.lowercased().hasPrefix("file://") {

+ 12 - 0
TSSmalCoacopods/Classes/Ex/UIImage+Ex.swift

@@ -304,3 +304,15 @@ public extension UIImage {
         }
     }
 }
+
+public extension UIImage {
+    // 压缩图片到指定尺寸
+    func compressImageSize(to size: CGSize) -> UIImage {
+        let targetSize = size
+        if self.size.width > targetSize.width || self.size.height > targetSize.height {
+            return kf.resize(to: targetSize)
+        }
+        return self
+    }
+    
+}