当我初始化实体的实例时,我得到了错误Variable used within its own initial value
。
这是引发错误的代码:
class func buildWordDefinition (word:String, language:Language, root:TBXMLElement) -> WordDefinition
{
let word = WordDefinition(word: word, language: language)
错误指向word
变量。
这是WordDefinition类:
class WordDefinition {
let word: String
let language: Language
init(word: String, language:Language)
{
self.word = word
self.language = language
}
}
这个错误是什么意思 ?
word
?