Skip to content

Commit 02de943

Browse files
committed
Fixed sizes.
1 parent 1d09daf commit 02de943

4 files changed

+18
-2
lines changed

Sources/SPDiffable/Collection/DataSource/SPDiffableCollectionDataSource.swift

+3-2
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,15 @@ open class SPDiffableCollectionDataSource: NSObject, SPDiffableDataSourceInterfa
3838
headerFooterProviders: [HeaderFooterProvider],
3939
headerAsFirstCell: Bool
4040
) {
41+
4142
self.headerAsFirstCell = headerAsFirstCell
4243
self.collectionView = collectionView
4344
self.sections = []
4445

4546
super.init()
4647

48+
self.collectionView?.delegate = self
49+
4750
self.appleDiffableDataSource = .init(
4851
collectionView: collectionView,
4952
cellProvider: { collectionView, indexPath, itemIdentifier in
@@ -86,8 +89,6 @@ open class SPDiffableCollectionDataSource: NSObject, SPDiffableDataSourceInterfa
8689
return nil
8790
}
8891
)
89-
90-
self.collectionView?.delegate = self
9192
}
9293

9394
// MARK: - Configure

Sources/SPDiffable/Table/Cells/SPDiffableSubtitleTableViewCell.swift

+5
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,9 @@ open class SPDiffableSubtitleTableViewCell: UITableViewCell {
3838
accessoryView = nil
3939
detailTextLabel?.text = nil
4040
}
41+
42+
open override func sizeThatFits(_ size: CGSize) -> CGSize {
43+
let superSize = super.sizeThatFits(size)
44+
return .init(width: superSize.width, height: superSize.height + 4)
45+
}
4146
}

Sources/SPDiffable/Table/Cells/SPDiffableTableViewCell.swift

+5
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,9 @@ open class SPDiffableTableViewCell: UITableViewCell {
3838
accessoryView = nil
3939
detailTextLabel?.text = nil
4040
}
41+
42+
open override func sizeThatFits(_ size: CGSize) -> CGSize {
43+
let superSize = super.sizeThatFits(size)
44+
return .init(width: superSize.width, height: superSize.height + 4)
45+
}
4146
}

Sources/SPDiffable/Table/Cells/SPDiffableTextFieldTableViewCell.swift

+5
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,9 @@ open class SPDiffableTextFieldTableViewCell: UITableViewCell {
5757
height: contentView.frame.height
5858
)
5959
}
60+
61+
open override func sizeThatFits(_ size: CGSize) -> CGSize {
62+
let superSize = super.sizeThatFits(size)
63+
return .init(width: superSize.width, height: superSize.height + 4)
64+
}
6065
}

0 commit comments

Comments
 (0)