Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
weak看起来 Swift 对修饰符并不满意。删除它,代码将编译。从这里我们可以看出,推荐网点强,除非你真的有一个保留周期。有关如何查找保留周期的信息,请参见我的答案。
weak
在 Swift 4 中,您将能够使用新的\键路径语法来执行此操作:
\
// no problems with "weak"! let observation = observe(\.cardContainerView.center) { (object, change) in ... }