Comments (4)
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.
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.
Thank you for reporting! I have workaround the issue for now. Could you make sure that the problem is fixed?
from ibpcollectionviewcompositionallayout.
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)
- the below code of layout section before iOS 13 is not work correctly HOT 2
- No such module 'IBPCollectionViewCompositionalLayout' in UI Test if added via SPM
- Crash on below iOS 13 devices. *** Assertion failure in -[UICollectionViewData layoutAttributesForDecorationViewOfKind:atIndexPath:] HOT 1
- IBPCollectionCompositionalLayoutSolverResult is empty and crashed HOT 1
- Release v0.6.8
- Mistake.
- Fatal error when passing data between view controllers using prepare for segue HOT 1
- visibleCells is empty in iOS 12 HOT 2
- [New Feature Request] Add New Feature in iOS 14 HOT 2
- Generic dataSource.
- [Crash] Any UICollectionLayoutSectionOrthogonalScrollingBehavior except .none cause crash on iOS 11 HOT 2
- Group. ContentInsets iOS12 in the bottom and the trailing cannot properly HOT 3
- [Crash in Swift] When 'debugPrint(visibleItems.first?.indexPath)' in the block of visibleItemsInvalidationHandler HOT 4
- the key define is NSString, here is use NSIndex of key. how reuse this case?
- [Crash]Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'no UICollectionViewLayoutAttributes instance for -layoutAttributesForDecorationViewOfKindOfKind:
- [Crash] Thread 1: EXC_ARITHMETIC (code=EXC_I386_DIV, subcode=0x0)
- collectionView(_ collectionView: UICollectionView, willDisplay cell: UICollectionViewCell, forItemAt indexPath: IndexPath) is unexpected
- how to inhert from the layout
- Any update on this repository?
- interItemSpacing issue for nested group HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ibpcollectionviewcompositionallayout.