Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swift 3: NSNotification vs Notification

Tags:

swift3

In Swift 3, what are the differences between Notification vs NSNotification?

Specifically, in Notification struct, there is a ReferenceType typealias of NSNotification. How is ReferenceType being used here?

public struct Notification : ReferenceConvertible, Equatable, Hashable {

    public typealias ReferenceType = NSNotification
    ...
}
like image 736
Boon Avatar asked Nov 20 '16 23:11

Boon


1 Answers

Notification is a struct wrapper around NSNotification. You can bridge between the two using as, which is what ReferenceConvertible does.

like image 122
Alexander Avatar answered Oct 16 '22 03:10

Alexander