试图在自己的 willSet 中存储到 属性 ''

Attempting to store to property '' within its own willSet

我在编辑器中收到一个奇怪的警告,我需要帮助了解它想要什么

Attempting to store to property 'someProperty' within its own willSet, which is about to be overwritten by the new value

var someProperty:SomeClass! {
    willSet { someProperty?.someFunction() } // Get warning: Attempting to store to property 'someProperty' within its own willSet, which is about to be overwritten by the new value
    didSet { ... }
}

当我 运行 它正在执行我希望它执行的操作时,控制台中没有崩溃或警告,所以我认为这只是一个误报。那么我可以以任何方式抑制它,因为它很烦人吗? :(

这是一个已知错误,已在 Apple 开发者论坛中报告:https://devforums.apple.com/message/1065306#1065306,以及解决方法 添加显式 self:

    willSet {
        self.someProperty?.someFunction()
    }

更新: 我无法用 Xcode 7.3.1 或 Xcode 8 重现该问题 再也没有了,所以现在似乎已经修复了。