1

We recently decided to try and incorporate Parchment into our app since it would suit our needs perfectly. We also added a collapsing header effect with it. So we first made a test project to test it out and just as we had refactored it into our own app we noticed a very strange bug that we just can't seem to pinpoint the problem with. At first we thought maybe its something in our own app but i opened up the test project and its there as well.

This GIF will show you the issue. Its even worse when we only have one tab/screen. It then even gets hard to scroll down for a refresh properly without triggering this issue.

GIF

Anyone have any idea as of why and where this might be happening ?

Sample code for the Parchment implementation:

private var pagingViewController = PagingViewController()

pagingViewController.dataSource = self
pagingViewController.register(PagingCustomCell.self, for: CustomPagingItem.self)
addChild(pagingViewController)
pagingViewController.borderOptions = .hidden
pagingViewController.menuItemSize = .selfSizing(estimatedWidth: 100, height: 40)
pagingViewController.indicatorClass = CustomIndicatorView.self
pagingViewController.indicatorOptions = .visible(
    height: 32,
    zIndex: -1,
    spacing: .zero,
    insets: UIEdgeInsets(top: 0, left: 0, bottom: 5, right: 0)
)
pagingViewController.indicatorColor = .purple
pagingViewController.collectionView.contentInset = UIEdgeInsets(top: 0, left: 16, bottom: 0, right: 16)

view.addSubview(pagingViewController.view)
pagingViewController.backgroundColor = .clear
pagingViewController.didMove(toParent: self)
pagingViewController.view.translatesAutoresizingMaskIntoConstraints = false
pagingViewController.view.snp.makeConstraints { (m) in
    m.top.equalTo(headerView.snp.bottom)
    m.left.right.bottom.equalToSuperview()
}

// Put shadow beneath tabs for collapsing header
pagingViewController.collectionView.layer.masksToBounds = true
pagingViewController.collectionView.layer.shadowOffset = CGSize(width: 0, height: 1)
pagingViewController.collectionView.layer.shadowRadius = 1
pagingViewController.collectionView.layer.shadowOpacity = 0.3

extension ViewController: PagingViewControllerDataSource {
    
    func numberOfViewControllers(in pagingViewController: PagingViewController) -> Int {
        return pages.count
    }
    
    func pagingViewController(_: PagingViewController, viewControllerAt index: Int) -> UIViewController {
        let currentVc = pages[index]
        
        if let currentVc = currentVc {
            return currentVc
        } else {
            let tableViewVC = TableViewController()
            tableViewVC.innerTableViewScrollDelegate = self
            
            pages[index] = tableViewVC
            
            return tableViewVC
        }
    }
    
    func pagingViewController(_: PagingViewController, pagingItemAt index: Int) -> PagingItem {
        return CustomPagingItem(index: index, text: "View \(index+1)")
    }
}
Peter S
  • 39
  • 5

1 Answers1

1

Well, it's not really a solution, but it appears this issue is not present in version 2.4.0, so a rollback to that and the issue dissapeared. I will keep looking out for future updates and see if it is fixed then however.

Github post with answer

Peter S
  • 39
  • 5