title: How to access cell members (for animation) from scrollViewDidScroll method in UICollectionViewController?
body: <p>How do I access members (an UIImage or UITextView) added to the view in a UICollectionViewCell from the scrollViewDidScroll method in the UICollectionViewController?</p>
  
  <p>I would like to animate i.e. move the image and text at "different speed" while scrolling vertically to the next cell.</p>
  
  <p>I understand that this can be done within the scrollViewDidScroll method but I don't know how to access the members.</p>
  
  <p><strong>the ViewController:</strong></p>
  
  <pre><code>class OnboardingViewController: UICollectionViewController, UICollectionViewDelegateFlowLayout {
  
      override func scrollViewDidScroll(_ scrollView: UIScrollView) {
       **code here which I just can't figure out....**
      }
  
      override func viewDidLoad() {
          super.viewDidLoad()
  
          collectionView?.backgroundColor = .white
          collectionView?.register(PageCell.self, forCellWithReuseIdentifier: "cellId")
          collectionView?.isPagingEnabled = true
          collectionView.showsHorizontalScrollIndicator = false
  
          // this method "creates" the UIPageControll and assigns  
          setupPageControl()
      }
  
      lazy var pageControl: UIPageControl = {
          let pageControl = UIPageControl()
          pageControl.currentPage     = 0
          pageControl.numberOfPages   = data.count &lt;--- data provided by a model from a plist - works perfectly
          pageControl.currentPageIndicatorTintColor   = .black
          pageControl.pageIndicatorTintColor          = .gray
          pageControl.translatesAutoresizingMaskIntoConstraints  = false
  
          return pageControl
      }()
  
      private func setupPageControl() {
          view.addSubview(pageControl)
          NSLayoutConstraint.activate([
              onboardingPageControl.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor),
              onboardingPageControl.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor, constant: 16),
              onboardingPageControl.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor, constant: -16),
          ])
      }
  
  </code></pre>
  
  <p>all the other override methods are implemented in an extension and working fine i.e. </p>
  
  <pre><code>numberOfItemsInSection section: Int) -&gt; Int {
          return data.count
      }
  </code></pre>
  
  <p><strong>This is the PageCell:</strong></p>
  
  <pre><code>class PageCell: UICollectionViewCell {
  
      var myPage: MyModel? {
          didSet {
              guard let unwrappedPage = myPage else { return }
  
              // the image in question:
              myImage.image = UIImage(named: unwrappedPage.imageName)
              myImage.translatesAutoresizingMaskIntoConstraints = false
              myImage.contentMode   = .scaleAspectFit
  
              // the text in question
              let attributedText = NSMutableAttributedString(string: unwrappedPage.title, attributes: [:])
              attributedText.append(NSAttributedString(string: "\n\(unwrappedPage.description)", attributes: [:]))
              myText.attributedText = attributedText
              myText.translatesAutoresizingMaskIntoConstraints    = false
              myText.textColor                                    = .black
              myText.textAlignment                                = .center
              myText.isEditable                                   = false
              myText.isScrollEnabled                              = false
              myText.isSelectable                                 = false
      }
  
      let myImage: UIImageView = {
          let imageView           = UIImageView()
          return imageView
      }()
  
      let myText: UITextView = {
          let textView    = UITextView()
          return textView
      }()
  
      fileprivate func setup() {
          addSubview(myImage)
          NSLayoutConstraint.activate([
              myImage.safeAreaLayoutGuide.topAnchor.constraint(equalTo: safeAreaLayoutGuide.topAnchor, constant: 60),
              myImage.centerXAnchor.constraint(equalTo: centerXAnchor),
              myImage.leadingAnchor.constraint(equalTo: leadingAnchor),
              myImage.trailingAnchor.constraint(equalTo: trailingAnchor),
              myImage.heightAnchor.constraint(equalTo: heightAnchor, multiplier: 0.4)
          ])
  
          addSubview(myText)
          NSLayoutConstraint.activate([
              myText.topAnchor.constraint(equalTo: myImage.bottomAnchor, constant: 16),
              myText.leadingAnchor.constraint(equalTo: leadingAnchor, constant: 16),
              myText.trailingAnchor.constraint(equalTo: trailingAnchor, constant: -16)
          ])
      }
  
      override init(frame: CGRect) {
          super.init(frame: frame)
          setup()
      }
  
      required init?(coder: NSCoder) {
          fatalError("init(coder:) has not been implemented")
      }
  
  }
  </code></pre>