When declaring notification names, is there any way to avoid mistakes like this?
extension Notification.Name {
static let userHasLoggedIn = Notification.Name("userHasLoggedIn")
//oops! developer forgot to change the literal...
static let userHasLoggedOut = Notification.Name("userHasLoggedIn")
}
I am hoping for some kind of way to use the variable name as the notification name without having to re-type it. Something like this:
extension Notification.Name {
//wishful thinking??
static let userHasLoggedIn = Notification.Name(#fieldname)
static let userHasLoggedOut = Notification.Name(#fieldname)
}