Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swift 3 - How to use enum raw value as NSNotification.Name?

Tags:

I'm using Xcode 8 beta 5 and I'm trying to setup an enum of notifications like this

enum Notes: String {
  case note1
  case note2
}

Then trying to use them as the notification names

NotificationCenter.default.post(name: Notes.note1.rawValue as NSNotification.Name,
                                object: nil, userInfo: userInfo)

But I'm getting an error.

Cannot convert value of type 'String' to specified type 'NSNotification.Name'

Is there a work around, or am I missing something? It works in Xcode 7.3.1

Any help would be appreciated.