I am logging class names and enums in Swift project. I saw its appending project name as prefix in each of instances string description. For example,
I created extension of NSObject,
public extension NSObject {
var classTag: String {
return NSStringFromClass(type(of: self))
}
}
I am using in in AppDelegate,
class AppDelegate: UIResponder, UIApplicationDelegate {
func testFunc() {
print(classTag, "Testing log")
}
}
Its output is,
TestProject.AppDelegate Testing log
How can I remove TestProject. and print only AppDelegate?
NB: When I am printing or logging enums its behaving same (i.e. appending Project name automatically in description)
You can simply use
String(describing:)instead ofNSStringFromClasslike so,