Advertisement
priore

Print stack trace just with classes names and method names

Feb 1st, 2019
500
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 0.64 KB | None | 0 0
  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.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement