Open coinbump opened 5 years ago
Well, using automaticDimension
by default would also not be correct because I can imagine that many times the height of a header or footer view is not completely defined by its constraints.
And it is still easy to define the height
variable of the header or footer when defining it:
header?.height = { UITableView.automaticDimension }
What do you think?
Personally, I like automaticDimension better, but it's up to the authors of this project.
If you have a sectionHeader, even if it only has a label, that label might be using dynamic type, which can be dynamically sized so a fixed size won't make sense.
Also, I'm used to projects where every view is loaded from a xib, not created programatically, so it's standard to have UI constraints.
I get what you mean but defaulting to .automaticDimension
would disable the option of setting the height of the view like it is in the xib file.
That is why I'd prefer to leave it as it is. Just set header.height to .automaticDimension
If you load a section header view from a nib, the logic for determining whether to use automaticDimension is incorrect (code is below):
A view loaded from a nib has a default height, but that is almost never the true height of the section header view since any changes in labels or the system-wide dynamic text sizes will result in this value being wrong.
This logic is incorrect.
In Core.swift: