Print Class Name of Current File in Swift

前端 未结 6 1625
[愿得一人]
[愿得一人] 2020-12-30 03:36

I\'m trying to print the name of the current class in Swift. More specifically, I\'d like achieve the following output:

myFunction() in ClassContainingTheFun         


        
6条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-30 04:06

    My short answer is,

    print(" Function name : \(#function), Class Name : \(self.dynamicType), File Path : \(#file)")
    

提交回复
热议问题