Notification Center is not working in collectionView DidSelect in iOS Swift?



I am trying to receive data from notification addObserve. But observer does not receive any data. Posting data from collectionView DidSelect and receiving from another UIViewController. it does not called.

Here is my code:

    public func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath)
        let imageDataDict:[String: Any] = ["image": self.setTabData]
        print("image dict index::::", imageDataDict)
        Notification.Name("dynamicIndex"), object: nil, userInfo: imageDataDict)

Receiver end UIViewController I have added this code

Add this in ViewDidload

     NotificationCenter.default.addObserver(self, selector: #selector(self.dynamicViewIndex(notification:)), name: Notification.Name("dynamicIndex"), object: nil)

Notification center observer objc function

    @objc func dynamicViewIndex(notification: NSNotification) {
         // handling code

         print("dynamic index value observered", notification)

        if let dict = notification.userInfo as NSDictionary? {

            if let ValueID = dict["image"] as? UInt {

                print("UInt index val:::", ValueID)




Any help much appreciated please…