Skip to content

Instantly share code, notes, and snippets.

@leoneparise
Created January 27, 2017 13:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save leoneparise/fee982fa247217f20dbcb99c551edc96 to your computer and use it in GitHub Desktop.
Save leoneparise/fee982fa247217f20dbcb99c551edc96 to your computer and use it in GitHub Desktop.
extension Notifications {
struct openUserProfile:NotificationType {
var userId:String
static var name: Notification.Name {
return Notification.Name(“LP_openUserProfile”)
}
var name:Notification.Name {
return openUserProfile.name
}
var userInfo: [String : Any] {
return [ “userId” : userId]
}
init(userId: String) {
self.userI = userId
}
init?(notification: Notification?) {
guard
let name = notification?.name,
let userId = notification?.userInfo?[“userId”] as? String,
name == openUserProfile.name
else { return nil }
self.userId = userId
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment