I am writing some Swift code and I would like to know the class of the object that called the function. I don\'t want to pass in any parameters. From within the function I w
You can use following template to know from which file, line number in file, and function this someFunction is called:
func someFunction(file: String = #file, line: Int = #line, function: String = #function) { NSLog("\(file.lastPathComponent):\(line) : \(function)") }