Explorar el Código

Optimize MD5 String By `reduce` Function

程鹏 hace 6 años
padre
commit
7ea58dcc89
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  1. 1 1
      Sources/Utility/String+MD5.swift

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

@@ -44,6 +44,6 @@ extension KingfisherWrapper where Base == String {
         }
         }
         #endif
         #endif
         
         
-        return digest.map { String(format: "%02x", $0) }.joined()
+        return digest.reduce(into: "") { $0 += String(format: "%02x", $1) }
     }
     }
 }
 }