I'm following this tutorial for Notification Center, and it suggests to create an extension for Notification.Name
to handle all names, so I created a new Swift file called Notification+Name.swift
with these contents:
import Foundation
extension Notification.Name {
static let URLContainerDidAddURL = NSNotification.Name("URLContainerDidAddURL")
}
But I'm getting the following error:
'Name' is not a member type of 'Notification'
What's going on? Why am I getting this?
Try this
extension Notification.Name {
static let URLContainerDidAddURL = Notification.Name("URLContainerDidAddURL")
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.