Literal Type Value
#file String The name of the file in which it appears.
#line Int The line number on which it appears.
#column Int The column number in which it begins.
#function String The name of the declaration in which it appears.
#dsohandle String The dso handle.
Exemple
print("Function: \(#function), line: \(#line)")
Avec les valeurs par défaut dans les paramètres, vous pouvez également créer une fonction
public func track(_ message: String, file: String = #file, function: String = #function, line: Int = #line ) {
print("\(message) called from \(function) \(file):\(line)")
}
qui peut être utilisée comme ceci
track("enters app")
Dans Swift 2.1
Literal Type Value
__FILE__ String The name of the file in which it appears.
__LINE__ Int The line number on which it appears.
__COLUMN__ Int The column number in which it begins.
__FUNCTION__ String The name of the declaration in which it appears.
pour plus d'informations, voir la Documentation
Vérifier La Documentaion