在Objective- C中,我们可以使用__LINE__和__PRETTY_FUNCTION__宏。这些未在Swift语言中公开。在Swift中还有另一种获取类似信息的方法吗?
__LINE__
__PRETTY_FUNCTION__
在斯威夫特语言参考定义,提供此行为的一些“特殊文字”:
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.