Skip to content

Collection view publishers should not have an effect before subscription #62

@RoryKelly

Description

@RoryKelly

Describe the bug
simply referencing the willDisplayCellPublisher will change the delegate of your collection view. This should only happen After subscription.

    var willDisplayCellPublisher: AnyPublisher<(cell: UICollectionViewCell, indexPath: IndexPath), Never> {
        let selector = #selector(UICollectionViewDelegate.collectionView(_:willDisplay:forItemAt:))
        return delegateProxy.interceptSelectorPublisher(selector)
            .map { ($0[1] as! UICollectionViewCell, $0[2] as! IndexPath) }
            .eraseToAnyPublisher()
    }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @RoryKelly

        Issue actions

          Collection view publishers should not have an effect before subscription · Issue #62 · CombineCommunity/CombineCocoa