gpt4 book ai didi

swift3 - swift 3 : NSNotification vs Notification

转载 作者:行者123 更新时间:2023-12-02 06:43:35 25 4
gpt4 key购买 nike

在 Swift 3 中,NotificationNSNotification 之间有什么区别?

具体来说,在Notification结构中,有一个NSNotification的ReferenceType类型别名。这里如何使用ReferenceType?

public struct Notification : ReferenceConvertible, Equatable, Hashable {

public typealias ReferenceType = NSNotification
...
}

最佳答案

NotificationNSNotification 的结构包装器。您可以使用 as 在两者之间建立桥梁,这就是 ReferenceConvertible 的作用。

关于swift3 - swift 3 : NSNotification vs Notification,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40710751/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com