priore

Print stack trace just with classes names and method names

Feb 1st, 2019
129
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Print stack trace just with classes names and method names
  2.  
  3.     private func printDebugStackTrace(fname: String? = nil) {
  4.         let stackSymbols = Thread.callStackSymbols
  5.         stackSymbols.forEach {
  6.             let components = $0.replacingOccurrences(
  7.                 of: "[A-Z]{1,1}\\d{1,2}|\\s+|yy+|SSS+",
  8.                 with: " ",
  9.                 options: .regularExpression,
  10.                 range: nil).components(separatedBy: " ")
  11.             if components[3] == "$", components.count > 5, components[5] != "UWImage" {
  12.                 debugPrint("Class \(components[5]).\(components[6])".trim())
  13.             }
  14.         }
  15.     }
RAW Paste Data