You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This works fine for collections (CollectionViewSupplementaryViewModel) ✅
This will break tables (TableViewSectionHeaderFooterViewModel), which also have a var title: String?. Tables can provide strings to get the default table view headers, or register views. Right now we model this as two optionals:
publicprotocolTableViewSectionHeaderFooterViewModel:ReusableSupplementaryViewProtocol{vartitle:String?{get}
// comes from ReusableSupplementaryViewProtocol
// var viewInfo: SupplementaryViewInfo? { get }
This should probably be an enum instead (essentially: Either<String, SupplementaryViewInfo>).
However, that introduces problems for ReusableSupplementaryViewProtocol, which must be adopted by both tables and collections.
Unless: we provide default "label-only" collection view headers in the library, such that you can just provide a String title for collections too. I'm leaning toward this. If the header just has a UILabel, clients can configure it however they want (fonts, colors, etc.) This is the approach I used in JSQDataSourcesKit: https://github.com/jessesquires/JSQDataSourcesKit/blob/develop/Source/TitledSupplementaryView.swift
The text was updated successfully, but these errors were encountered:
We have:
This should be not optional.
This works fine for collections (
CollectionViewSupplementaryViewModel
) ✅This will break tables (
TableViewSectionHeaderFooterViewModel
), which also have avar title: String?
. Tables can provide strings to get the default table view headers, or register views. Right now we model this as two optionals:This should probably be an
enum
instead (essentially:Either<String, SupplementaryViewInfo>
).However, that introduces problems for
ReusableSupplementaryViewProtocol
, which must be adopted by both tables and collections.Unless: we provide default "label-only" collection view headers in the library, such that you can just provide a
String
title for collections too. I'm leaning toward this. If the header just has aUILabel
, clients can configure it however they want (fonts, colors, etc.) This is the approach I used in JSQDataSourcesKit: https://github.com/jessesquires/JSQDataSourcesKit/blob/develop/Source/TitledSupplementaryView.swiftThe text was updated successfully, but these errors were encountered: