-
Notifications
You must be signed in to change notification settings - Fork 219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why MagazineLayoutCollectionViewLayoutAttributes is final
?
#67
Comments
@AntonBelousov I think, in general, With that said, I think this change will take more than just making May I ask what your end goal is? What properties are you using in your custom layout attributes subclass? |
There are only 6 places in code where an instance of MagazineLayoutCollectionViewLayoutAttributes is created: 2 for cells, 4 for supplementary views. I can suggest
or b) calling initializer like this:
I have some cells that may change their appearance/layout depending on the context. Now it’s convenient for me to pass context through attributes |
@AntonBelousov sorry for the delay - I think making |
The problem
I use
UICollectionView
with custom layout in my app. I wanted to migrate toMagazineLayout
. But I use customUICollectionViewLayoutAttributes
, so I need to somehow extendMagazineLayoutCollectionViewLayoutAttributes
to use with my cells.But since
MagazineLayoutCollectionViewLayoutAttributes
is final - I can't just subclass it.The solution I'd like
Make it non-final
Alternatives I've considered
a) Make
MagazineLayout
non-final, and let subclasses provide type ofUICollectionViewLayoutAttributes
which conforms to protocol:Make MagazineLayoutCollectionViewLayoutAttributes conform this protocol :
b) Use objc runtime to extend
MagazineLayoutCollectionViewLayoutAttributes
c) Add property into
MagazineLayoutCollectionViewLayoutAttributes
(some key-value collection), to hold additional parametersThe text was updated successfully, but these errors were encountered: