 extension NotificationCenter {
 
     func clearAllNotifications() {
+        timer = nil
         userNotificationCenter.removeAllDeliveredNotifications()
         notifications.removeAll()
     }


    private let userNotificationCenter: NSUserNotificationCenter
    private var notifications = [Notification]()

    private init(userNotificationCenter: NSUserNotificationCenter = NSUserNotificationCenter.defaultUserNotificationCenter()) {
        self.userNotificationCenter = userNotificationCenter

        let userNotification = NSUserNotificationBuilder.build(notification)
        notifications.append(notification)
        userNotificationCenter.deliverNotification(userNotification)

        timer = Timer(interval: 30.0) { [weak self] _ in
            self?.clearAllNotifications()
        }
    }
}

