Create postDisplayNameDidChangeNotification, so that a DisplayNameProvider can post a Notification when its name changes.
This commit is contained in:
parent
6ec2f72443
commit
786138d6e7
|
@ -8,8 +8,21 @@
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
extension Notification.Name {
|
||||||
|
|
||||||
|
public static let DisplayNameDidChange = Notification.Name("DisplayNameDidChange")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public protocol DisplayNameProvider {
|
public protocol DisplayNameProvider {
|
||||||
|
|
||||||
var nameForDisplay: String { get }
|
var nameForDisplay: String { get }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public extension DisplayNameProvider {
|
||||||
|
|
||||||
|
func postDisplayNameDidChangeNotification() {
|
||||||
|
|
||||||
|
NotificationCenter.default.post(name: .DisplayNameDidChange, object: self, userInfo: nil)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue