Print Class Name of Current File in Swift

前端 未结 6 1605
[愿得一人]
[愿得一人] 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:00

    print("=== \(type(of: self)).\(#function):\(#line) - message")
    

    result

    === HomeScene.onAppear():189 - message
    

提交回复
热议问题