在Swift 3中,Notification
与NSNotification
之间有什么区别?
具体来说,在Notification struct中,ReferenceType类型为NSNotification
。 ReferenceType是如何在这里使用的?
public struct Notification : ReferenceConvertible, Equatable, Hashable {
public typealias ReferenceType = NSNotification
...
}
答案 0 :(得分:1)
Notification
是围绕NSNotification
的结构包装器。您可以使用as
来完成两者之间的桥接,这是ReferenceConvertible
所做的。