I use the following code to show the date of the day on the icon but the date will not be updated for the next day unless I enter the app :
let date = NSDate()
let calender = NSCalendar(calendarIdentifier: NSCalendar.Identifier.persian)
let components = calender?.components(NSCalendar.Unit(rawValue: UInt.max), from: date as Date)
let day = components!.day
let badgeCount: Int = day!
let application = UIApplication.shared
let center = UNUserNotificationCenter.current()
center.requestAuthorization(options:[.badge, .alert, .sound]) { (granted, error) in }
application.registerForRemoteNotifications()
application.applicationIconBadgeNumber = badgeCount