Juanpe / Juanpe/SkeletonView

UICollectionViewCompositionalLayout with orthogonal section breaks skeletonable chain

Open
#504 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Swift
Stars
12.9k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

Description

Hey!

We are using your awesome lib with UICollectionView for quite a while and everything was just perfect before we decided to migrate to UICollectionViewCompositionalLayout. Specifically, we have one section that has orthogonalScrollingBehavior set to .continuous.

What type of issue is this? (place an x in one of the [ ])
  • [ x ] bug
  • enhancement (feature request)
  • question
  • documentation related
  • discussion
Requirements (place an x in each of the [ ])
  • [ x ] I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • [ x ] I've read and agree to the Code of Conduct.
  • [ x ] I've searched for any related issues and avoided creating a duplicate issue.

Bug Report

Filling out the following details about bugs will help us solve your issue sooner.

SkeletonView Environment:

SkeletonView version: 1.29.3
Xcode version: 13.4.1
Swift version: 5

Steps to reproduce:

Please replace this with the steps to reproduce the behavior.

  1. Use UICollectionView with UICollectionViewCompositionalLayout and orthogonalScrollingBehavior.
  2. Set isSkeletonable for collection view and section items to true.
Expected result:

Section with orthogonalScrollingBehavior is skeletoned.

Actual result:

Section with orthogonalScrollingBehavior is not skeletoned.

Attachments:

Investigation results:
It seems that for orthogonalScrollingBehavior system wraps items in _UICollectionViewOrthogonalScrollerEmbeddedScrollView, which obviously is not reachable directly and breaks isSkeletonable chain.

Possible workaround:
I came up with the workaround, that is probably a bit too hacky for a PR. So I decided to open the issue instead.

extension UIScrollView {
    var isOrthogonalScrollView: Bool {
        let isInCollectionView = superview as? UICollectionView != nil
        return isInCollectionView && subviews.contains { $0.isSkeletonable }
    }

    override public var isSkeletonable: Bool {
        get {
            super.isSkeletonable || isOrthogonalScrollView
        }
        set {
            super.isSkeletonable = newValue
        }
    }
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with UICollectionViewCompositionalLayout, a section using orthogonalScrollingBehavior, and isSkeletonable enabled on the collection view and its items. Inspect the UIScrollView isSkeletonable chain around the system-created orthogonal scroller; done means the orthogonal section is skeletoned without relying on the reported workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
mobile-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.