Giter Site home page Giter Site logo

Comments (4)

hadyhallak avatar hadyhallak commented on May 28, 2024 1

To demonstrate the issue,, I updated TextCell from Apple samples to display the current cell number.

here's the code

/*
 See LICENSE folder for this sample’s licensing information.
 
 Abstract:
 Generic text cell
 */

import UIKit

class TextCell: UICollectionViewCell {
    static var i = 1
    
    let label = UILabel()
    static let reuseIdentifier = "text-cell-reuse-identifier"
    let index: Int
    
    override init(frame: CGRect) {
        index = TextCell.i
        TextCell.i += 1
        
        super.init(frame: frame)
        configure()
    }
    required init?(coder: NSCoder) {
        fatalError("not implemnted")
    }
    
}

extension TextCell {
    func configure() {
        let lbl = UILabel()
        lbl.text = "\(index)"
        lbl.translatesAutoresizingMaskIntoConstraints = false
        contentView.addSubview(lbl)
        NSLayoutConstraint.activate([
            lbl.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: 8),
            lbl.topAnchor.constraint(equalTo: contentView.topAnchor, constant: 8),
            ])
        
        label.translatesAutoresizingMaskIntoConstraints = false
        label.adjustsFontForContentSizeCategory = true
        contentView.addSubview(label)
        label.font = UIFont.preferredFont(forTextStyle: .caption1)
        let inset = CGFloat(10)
        NSLayoutConstraint.activate([
            label.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: inset),
            label.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: -inset),
            label.topAnchor.constraint(equalTo: contentView.topAnchor, constant: inset),
            label.bottomAnchor.constraint(equalTo: contentView.bottomAnchor, constant: -inset)
            ])
    }
}

` ``

from ibpcollectionviewcompositionallayout.

kishikawakatsumi avatar kishikawakatsumi commented on May 28, 2024 1

Thanks. I agree with you. Using a customized collection view seems overkill. Also, it makes it more complicated for the user site. So I keep this until if we find another right way. (But I don't expect much.)

are PRs welcome?

Absolutely yes! Please try it, find bugs, and send PRs! I've implemented most of the features, but I'm sure there are still lots of bugs.

Now I'm working on adding support for Swift Package Manager. The directory structure will change significantly. Probably It's good to wait to finish it before you start.

from ibpcollectionviewcompositionallayout.

kishikawakatsumi avatar kishikawakatsumi commented on May 28, 2024

Thank you for reporting! I have workaround the issue for now. Could you make sure that the problem is fixed?

from ibpcollectionviewcompositionallayout.

hadyhallak avatar hadyhallak commented on May 28, 2024

Yeah thanks, that's solved the issue for now.

I noticed that you're registering and dequeuing cells from the nested collectionView now, which is pretty enough as a workaround.

But do you have any plans to improve this behavior?

I though of rewriting the reuse system in a custom UICollectionView and use that as the root collectionView. which will manage cells to be reused both inside it and across nested collection views (as iOS 13 now does). but that sounded a bit wrong to me,,, what do you think?

btw, are PRs welcome?

from ibpcollectionviewcompositionallayout.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.