 
   func searchBarTextDidBeginEditing(_ searchBar: UISearchBar) {
     isSearchActive = true
-    tableView.reloadData()
+    refreshTable()
   }
 
   @objc func dismissKeyboard() {
     self.view.endEditing(true)
     isSearchActive = false
-    tableView.reloadData()
+
+  }
+
+  func refreshTable() {
+    if #available(iOS 14.0, *) {
+      #if compiler(>=5.3)
+        applySnapshot()
+      #endif
+    } else {
+      tableView.reloadData()
+    }
   }
 
   @objc(gestureRecognizer:shouldReceiveTouch:)

  }

  func updateScrollViewWithKeyboardNotificationUserInfo(userInfo: [AnyHashable: Any]) {
    guard let endFrame = userInfo[AnyHashable("UIKeyboardFrameEndUserInfoKey")] as? CGRect
    else { return }
    let endKeyboardFrameOriginInWindow = view.convert(endFrame.origin, from: nil)
    let tableViewMaxY = tableView.frame.maxY
    let baseInset = tableViewMaxY - endKeyboardFrameOriginInWindow.y
    let scrollIndicatorInset = baseInset
    var contentInset = baseInset
    if #available(iOS 11, *) {
      if endKeyboardFrameOriginInWindow.y < tableViewMaxY {
        contentInset -= view.safeAreaInsets.bottom
      }
    }
    tableView.contentInset.bottom = contentInset
    tableView.scrollIndicatorInsets.bottom = scrollIndicatorInset
  }
}

    headerViewController.headerView.addSubview(headerView)
    headerViewController.headerView.forwardTouchEvents(for: headerView)
    headerViewController.headerView.backgroundColor = Constants.headerColor
    if #available(iOS 14.0, *) {
      headerViewController.headerView.trackingScrollView = collectionView
    } else {
      headerViewController.headerView.trackingScrollView = tableView
    }
    view.addSubview(headerViewController.view)
    headerViewController.didMove(toParent: self)
  }
