kln пре 1 недеља
родитељ
комит
356933f589

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

@@ -39,4 +39,11 @@ public extension Date {
         return dateString
     }
     
+    
+    var dateDayString:String {
+        let dateFormatter = DateFormatter()
+        dateFormatter.dateFormat = "yyyyMMdd"
+        let dateString = dateFormatter.string(from: self)
+        return dateString
+    }
 }

+ 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
+    }
+    
+}