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
I was able to work around this in my case by casting to the base class:
(employee as Person).name = "Sally"
This still appears to do the proper dispatch to the subclass. For instance:
class Person {
var name: String {
return "person"
}
}
class Employee: Person {
override var name: String {
return "employee"
}
}
let bob = Person()
let alice = Employee()
println((alice as Person).name) // prints "employee"
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.
As @sgaw points out, this has been confirmed as a known bug by the Apple engineers (for Xcode 6 Beta - Version 6.0 (6A215l))
https://devforums.apple.com/thread/229668?tstart=0