title: Local and Push Notifications in IOS version compatible
body: <p>I developed <code>local Notifications</code> in <code>iOS 10</code>. It is working perfectly. But now how should i code <code>local notifications</code> and <code>push notification</code> if user is using <code>iOS 9</code> and above versions. Can anyone help please? </p>
  
  <p>Below is code in <code>iOS 10</code></p>
  
  <pre><code>import UIKit
  import UserNotifications
  
  @available(iOS 10.0, *)
  class ViewController: UIViewController,UNUserNotificationCenterDelegate {
      override func viewDidLoad() {
         super.viewDidLoad()
  
         if #available(iOS 10.0, *) {
          //Seeking permission of the user to display app notifications
          UNUserNotificationCenter.current().requestAuthorization(options: [.alert,.sound,.badge], completionHandler: {didAllow,Error in })
          UNUserNotificationCenter.current().delegate = self
  
         }
     }
  
     //To display notifications when app is running  inforeground
     func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -&gt; Void) {
         completionHandler([.alert, .sound, .badge])
     }
  
     override func didReceiveMemoryWarning() {
         super.didReceiveMemoryWarning()
         // Dispose of any resources that can be recreated.
     }
  
     @IBAction func buttonPressed(_ sender: UIButton) {
  
         if #available(iOS 10.0, *) {
  
             //Setting content of the notification
             let content = UNMutableNotificationContent()
             content.title = "hello"
             content.body = "notification pooped out"
             content.badge = 1
  
             //Setting time for notification trigger
             let date = Date(timeIntervalSinceNow: 10)
             var dateCompenents = Calendar.current.dateComponents([.year, .month, .day, .hour, .minute, .second], from: date)
  
             let trigger = UNCalendarNotificationTrigger(dateMatching: dateCompenents, repeats: false)
             //Adding Request
             let request = UNNotificationRequest(identifier: "timerdone", content: content, trigger: trigger)
             UNUserNotificationCenter.current().add(request, withCompletionHandler: nil)
          }
  
       }
  
   }
  </code></pre>