Is there a way to clear the remote notification from the notification banner when swiping down from the top of the iPhone screen. I tried setting the badge number to zero:
In Nov, 2019 below is the working solution for me with Swift 4. First you have to check the device version to clear all notifications but do not need to check to reset badge count.
override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]? ) -> Bool {
//--------
application.applicationIconBadgeNumber = 0
if #available(iOS 10.0, *) {
let center = UNUserNotificationCenter.current()
center.removeAllDeliveredNotifications()
center.removeAllPendingNotificationRequests()
} else {
application.cancelAllLocalNotifications()
}
//------
}