wenweiwei 2 gadi atpakaļ
vecāks
revīzija
b9b2d28aba

+ 1 - 1
BFCommonKit.podspec

@@ -8,7 +8,7 @@
 # update framework 2021.11.1
 Pod::Spec.new do |s|
   s.name             = 'BFCommonKit'
-  s.version          = '1.6.1'
+  s.version          = '1.6.2'
   s.summary          = '基础库'
   s.swift_version    = '5.0'
   s.description      = <<-DESC

+ 15 - 18
BFCommonKit/Classes/BFUtility/PQCommonMethodUtil.swift

@@ -50,7 +50,7 @@ public let versionCode = "\(Bundle.main.infoDictionary?["CFBundleVersion"] ?? "1
 // 版本号
 public let versionName = "\(Bundle.main.infoDictionary?["CFBundleShortVersionString"] ?? "1.0.0")"
 
-public let appRunIdentify : String = {
+public let appRunIdentify: String = {
     let dateFmt = DateFormatter()
     dateFmt.dateFormat = "MMddHHmmss"
     return dateFmt.string(from: Date())
@@ -127,7 +127,7 @@ public func bf_getCurrentViewController() -> UIViewController? {
 
 final class LogDestination: TextOutputStream {
     static let shared = LogDestination()
-    
+
     private var path: String = {
         var path = ""
         if let documentDirectoryPath = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first {
@@ -135,7 +135,7 @@ final class LogDestination: TextOutputStream {
         }
         return path
     }()
-    
+
     func write(_ string: String) {
         if let data = string.data(using: .utf8), let fileHandle = FileHandle(forWritingAtPath: path) {
             defer {
@@ -154,9 +154,8 @@ final class LogDestination: TextOutputStream {
 
  */
 public func BFLog<T>(_ type: Int = 0, _ file: String = #file, _ line: Int = #line, message: T) {
-    var printStr = ""
-
     #if DEBUG
+        var printStr = ""
         let filePath = (file as NSString).lastPathComponent
         let dateFmt = DateFormatter()
         dateFmt.dateFormat = "HH:mm:ss:SSSS"
@@ -167,15 +166,15 @@ public func BFLog<T>(_ type: Int = 0, _ file: String = #file, _ line: Int = #lin
             printStr = "ak-\(dateFmt.string(from: Date())) \(msg)"
         } else if type == 3 {
             printStr = "ww-\(dateFmt.string(from: Date())) \(msg)"
-        } else if type == 0{
+        } else if type == 0 {
             printStr = "\(dateFmt.string(from: Date())) \(msg)"
         }
         print(printStr)
     #else
-    if printStr.count > 0{
-        var dest = LogDestination.shared
-        print(printStr, to: &dest)
-    }
+//    if printStr.count > 0{
+//        var dest = LogDestination.shared
+//        print(printStr, to: &dest)
+//    }
 //    let filePath = (file as NSString).lastPathComponent;
 //    let dateFmt = DateFormatter()
 //    dateFmt.dateFormat = "HH:mm:ss:SSSS"
@@ -447,10 +446,10 @@ public func getMachineCode() -> String {
     return uuid
 }
 
-public func styleType(_ type:Int) -> ToastStyle{
+public func styleType(_ type: Int) -> ToastStyle {
     var syt = ToastStyle()
     switch type {
-    case 1 :
+    case 1:
         syt.messageColor = .black
         syt.backgroundColor = .white
         syt.messageFont = UIFont.systemFont(ofSize: 22, weight: .semibold)
@@ -460,7 +459,7 @@ public func styleType(_ type:Int) -> ToastStyle{
         syt = ToastManager.shared.style
         syt.messageAlignment = .center
     }
-    
+
     return syt
 }
 
@@ -1001,20 +1000,18 @@ public func synced(_ lock: Any, closure: () -> Void) {
 
 /**
  生成随机字符串,
- 
+
  - parameter length: 生成的字符串的长度
- 
+
  - returns: 随机生成的字符串
  */
 public func getRandomStringOfLength(length: Int) -> String {
     let characters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
 
     var ranStr = ""
-    for _ in 0..<length {
+    for _ in 0 ..< length {
         let index = Int(arc4random_uniform(UInt32(characters.count)))
         ranStr.append(characters[index])
     }
     return ranStr
-    
 }
-