title: How to get IndexPath for UICollectionView Header?
body: <p>View: HeaderView</p>
  
  <pre><code>class HeaderCell: UICollectionViewCell {
      //MARK: - Properties
  
  ....
  
      lazy var clearButton: UIButton = {
          let bt = UIButton(type: .custom)
          bt.backgroundColor = .clear
          bt.addTarget(self, action: #selector(handleClearButton(button:)), for: .touchUpInside)
          return bt
      }()
  
      weak var delegate: HeaderCellDelegate?
  
     //MARK: - Init
     required init?(coder aDecoder: NSCoder) {
          return nil
      }
  
      override init(frame: CGRect) {
          super.init(frame: frame)
          configureCell()
          addViews()
          setConstraints()
      }
  
  ....
  
      //MARK: - Handlers
      @objc func handleClearButton(button: UIButton) {
          delegate?.expandSelectedHeader(self)
      }
  
  </code></pre>
  
  <p>Protocol: HeaderCellDelegate</p>
  
  <pre><code>protocol HeaderCellDelegate: class {
      func expandSelectedHeader(_ header: UICollectionViewCell)
  }
  </code></pre>
  
  <p>Controller: SomeController </p>
  
  <pre><code>func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -&gt; UICollectionReusableView {
          switch kind {
          case UICollectionView.elementKindSectionHeader:
              let header = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: reuseIdentifierForHeader, for: indexPath) as! HeaderCell
              header.toMenuControllerDelegate = self
              return header
  
          case UICollectionView.elementKindSectionFooter:
              let footer = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: reuseIdentifierForFooter, for: indexPath) as! MenuFooterCell
              return footer
          default:
              return UICollectionReusableView()
          }
      }
  
  
  extension SomeController:HeaderCellDelegate {
      func expandSelectedHeader(_ header: UICollectionViewCell) {
          let indexPath = collectionView.indexPath(for: header)
          print(indexPath)
      }
  }
  </code></pre>
  
  <p>I am trying to using the clearButton inside headerView that when the button is tapped it will send itself(UIcollectionViewCell) to the controller. So once the controller receives information about the cell, I can use <code>collectionView.indexPath(for cell:UICollectionViewCell)</code> to get the indexPath of header in which the button is tapped. But with the code above, I am only getting <code>nil</code> for <code>print(indexPath)</code>.</p>
  
  <p>How can I go about the problem???
  I appreciate your help in advance. </p>