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

Arb*_*tur 9 xcode warnings ios swift

我在编辑器中得到了一个奇怪的警告,我需要帮助理解它想要的东西

Attempting to store to property 'someProperty' within its own willSet, which is about to be overwritten by the new value
Run Code Online (Sandbox Code Playgroud)
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 { ... }
}
Run Code Online (Sandbox Code Playgroud)

当我运行它时它正在执行我想要的操作,在控制台中没有崩溃或警告,所以我认为这只是一个误报.所以我能以任何方式压制它,因为它烦人吗?:(

Mar*_*n R 16

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

    willSet {
        self.someProperty?.someFunction()
    }
Run Code Online (Sandbox Code Playgroud)

更新:我无法再重现Xcode 7.3.1或Xcode 8的问题,所以现在似乎已经修复了.