Rely on original delegate for section row, delegate, and footer heights#460
Rely on original delegate for section row, delegate, and footer heights#460maadlog wants to merge 1 commit intoJuanpe:mainfrom
Conversation
9995c2a to
ee434a0
Compare
|
Hi, @maadlog 👋🏼 thanks for this PR! I've got a doubt about if this code works fine when the library calculates the number of rows. For example, in this line SkeletonCollectionDataSource.swift:42, we calculate the number of rows based on the height. But we are not considering that the sections or the cells could have different heights. A possible solution could be using only this code when the developer defines the number of rows. WDYT? |
|
Hi @Juanpe ! |
|
Hi @maadlog! Let me know if you need help to finish this feature :) |
|
@maadlog, Any updates on that? Don't worry if you don't have the bandwidth to do it. Let me know, and I could continue the development 😉 |
|
Hi @Juanpe ! Sorry about the late response, i got swamped with the start of the year and didn't get any bandwidth to continue. Feel free to continue the development and thanks for the patience! |
|
@maadlog Any updates on this? This may be very useful |
Summary
This PR attempts to provide the functionality required on issue #424 here
The approach was to delegate on the original table view delegate's implementation of the
heightForXXXandestimatedHeightForXXXfamily of methods.The main issue faced is that given that those methods are
optionals on the Objc protocol, then the return types aren't optional.I was about to return
UITableView.automaticDimension, which works similarly, but reading this piece of doc, it states that the value returned byheightForRowtakes precedence over the propertyrowHeight. Following that logic, and to avoid breaking any current implementations, i delegated on the tableView'sXXXheightandestimatedXXXHeightand properties, which i'm assuming (and please correct me if i'm wrong) are either properly set by users to the expected height orautomaticDimensionVideos
Different-heights-example.mp4
Default-heights-example.mp4
Steps to reproduce
Added on the iOS example:
ViewController > SkeletonTableViewDelegate
And to test the different heights you can use any set of hardcoded values, including
automaticDimensionRequirements (place an
xin each of the[ ])