From 786138d6e768548054f398b70d84e98da5c74040 Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Mon, 22 Jan 2018 21:58:53 -0800 Subject: [PATCH] Create postDisplayNameDidChangeNotification, so that a DisplayNameProvider can post a Notification when its name changes. --- Frameworks/RSCore/RSCore/DisplayNameProvider.swift | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Frameworks/RSCore/RSCore/DisplayNameProvider.swift b/Frameworks/RSCore/RSCore/DisplayNameProvider.swift index 35853931e..832b3ef15 100644 --- a/Frameworks/RSCore/RSCore/DisplayNameProvider.swift +++ b/Frameworks/RSCore/RSCore/DisplayNameProvider.swift @@ -8,8 +8,21 @@ import Foundation +extension Notification.Name { + + public static let DisplayNameDidChange = Notification.Name("DisplayNameDidChange") +} + + public protocol DisplayNameProvider { var nameForDisplay: String { get } } +public extension DisplayNameProvider { + + func postDisplayNameDidChangeNotification() { + + NotificationCenter.default.post(name: .DisplayNameDidChange, object: self, userInfo: nil) + } +}