Swift Error: Variable used within its own initial value

后端 未结 4 1434
灰色年华
灰色年华 2020-12-24 01:37

When I\'m initializing an instance of an entity I\'m getting the error Variable used within its own initial value.

Here is the code throwing the error:<

4条回答
  •  一个人的身影
    2020-12-24 02:16

    You are redefining a constant word which has the same name as a parameter within your function

    class func buildWordDefinition (word:String, language:Language, root:TBXMLElement) -> WordDefinition
    {
        // same name as the parameter here
        let word = WordDefinition(word: word, language: language)
    }
    

提交回复
热议问题