Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save annjose/65d247bdb6a294c34ea0c308335a7eec to your computer and use it in GitHub Desktop.
Save annjose/65d247bdb6a294c34ea0c308335a7eec 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.userId = 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