'dequeueReusableSupplementaryView' cannot be resolved without a contextual type iOS swift

 Problem:

My code

        collectionDataSource.configureSupplementaryView = { dataSource, collectionView, kind, indexPath in

            guard kind == UICollectionView.elementKindSectionHeader else {

                fatalError("Unexpected supplementary view kind")

            }

            let headerView = collectionView.dequeueReusableSupplementaryView(

                ofKind: kind,

                withReuseIdentifier"HeaderCell",

                for: indexPath

            ) asHeaderCell

    // my configurations are here

            return headerView

        }


It shows error that 'dequeueReusableSupplementaryView' cannot be resolved without a contextual type.
I don't know how to solve

Solution:
The above code is good only.You have to check the configuration that you had made in the code.Because if it had some errors it will show like that.So check the code lines.

Comments

Popular posts from this blog

Invalid bundle error while upload the app to the app Store

Convert NsNumber, NSDate to String in iOS Swift

Global LocationManager Singleton class iOS Swift