Reputation: 185
I have func which return struct array of randomly generated cryptocurrencies and then passes it to tableView. I've got this error Cannot convert value of type 'NSNotification.Name' to expected argument type 'Notification' Am I heading in the right direction or not?
Upvotes: 0
Views: 50
Reputation: 3064
A Notification.Name
is simply a String. What you need to do is construct a notification using this Name
. In your postNotification(notification:)
method, you are passing a String
, not a Notification
.
Try to replace this code: postNotification(notification: Notificator.dataUpdateNotification)
with this: postNotification(notification: Notification(name: Notificator.dataUpdateNotification))
.
You need to be passing a Notification
into this method, but you are passing Notification.Name
which is a String
, not a Notification
.
Upvotes: 2