Boon
Boon

Reputation: 41480

Swift 3: NSNotification vs Notification

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
    ...
}

Upvotes: 6

Views: 1435

Answers (1)

Alexander
Alexander

Reputation: 63167

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

Upvotes: 1

Related Questions