“Ambiguous use of 'propertyName'” error given overridden property with didSet observer

前端 未结 3 1953
面向向阳花
面向向阳花 2021-01-01 10:50

I\'ve got a simple scenario in which I have a parent class, Person, which defines a property called \"name\" and includes a \"didSet\" observer...

class Pers         


        
3条回答
  •  醉梦人生
    2021-01-01 11:23

    I got this error because I had two properties declared with the same name.

    On Objective-C the compiler used to give the error on the line the property was declared. Something like "duplicate property".

    Now on Swift you get "Ambiguous use of..." on the line that you use to property... and you have to look everywhere to find the duplicate property.

提交回复
热议问题