有没有一种方法可以获取Swift语言中的行号和函数名?
在Objective-
C中,我们可以使用__LINE__和__PRETTY_FUNCTION__宏。这些未在Swift语言中公开。在Swift中还有另一种获取类似信息的方法吗?
回答:
在斯威夫特语言参考定义,提供此行为的一些“特殊文字”:
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.
以上是 有没有一种方法可以获取Swift语言中的行号和函数名? 的全部内容, 来源链接: utcz.com/qa/422258.html








