美文网首页iOS Development
Weak, Strong, Unowned

Weak, Strong, Unowned

作者: panorama | 来源:发表于2017-02-25 11:13 被阅读0次

    “Define a capture in a closure as an unowned reference when the closure and the instance it captures will always refer to each other, and will always be deallocated at the same time.”

    “Use a weak reference whenever it is valid for that reference to become nil at some point during its lifetime. Conversely, use an unowned reference when you know that the reference will never be nil once it has been set during initialization.”

    相关文章

      网友评论

        本文标题:Weak, Strong, Unowned

        本文链接:https://www.haomeiwen.com/subject/wvigwttx.html