Skip to content

Commit 13d044b

Browse files
committed
Minor fixes
1 parent 05f7e6a commit 13d044b

File tree

78 files changed

+977
-894
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+977
-894
lines changed

ChatLayout.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'ChatLayout'
3-
s.version = '0.4.3'
3+
s.version = '0.4.4'
44
s.summary = 'An alternative solution to MessageKit. It uses custom UICollectionViewLayout to provide you full control over the presentation.'
55
s.swift_version = '5.2'
66

ChatLayout/Classes/Core/ChatLayout.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,12 @@ public final class ChatLayout: UICollectionViewLayout {
6767

6868
/// Represent the rectangle where all the items are aligned.
6969
public var layoutFrame: CGRect {
70+
guard let collectionView = collectionView else {
71+
return .zero
72+
}
7073
return CGRect(x: adjustedContentInset.left + settings.additionalInsets.left,
7174
y: adjustedContentInset.top + settings.additionalInsets.top,
72-
width: visibleBounds.width - settings.additionalInsets.left - settings.additionalInsets.right - adjustedContentInset.left - adjustedContentInset.right,
75+
width: collectionView.bounds.width - settings.additionalInsets.left - settings.additionalInsets.right - adjustedContentInset.left - adjustedContentInset.right,
7376
height: controller.contentHeight(at: state) - settings.additionalInsets.top - settings.additionalInsets.bottom - adjustedContentInset.top - adjustedContentInset.bottom)
7477
}
7578

@@ -678,7 +681,7 @@ public final class ChatLayout: UICollectionViewLayout {
678681

679682
let kind = ItemKind(elementKind)
680683
if state == .afterUpdate {
681-
if controller.insertedIndexes.contains(elementIndexPath) || controller.insertedSectionsIndexes.contains(elementIndexPath.section) {
684+
if controller.insertedSectionsIndexes.contains(elementIndexPath.section) {
682685
attributes = controller.itemAttributes(for: elementIndexPath, kind: kind, at: .afterUpdate)
683686
attributes?.alpha = 0
684687
attributesForPendingAnimations[kind]?[elementIndexPath] = attributes
@@ -710,7 +713,7 @@ public final class ChatLayout: UICollectionViewLayout {
710713

711714
let kind = ItemKind(elementKind)
712715
if state == .afterUpdate {
713-
if controller.deletedIndexes.contains(elementIndexPath) || controller.deletedSectionsIndexes.contains(elementIndexPath.section) {
716+
if controller.deletedSectionsIndexes.contains(elementIndexPath.section) {
714717
attributes = controller.itemAttributes(for: elementIndexPath, kind: kind, at: .beforeUpdate) ?? ChatLayoutAttributes(forSupplementaryViewOfKind: elementKind, with: elementIndexPath)
715718
attributes?.alpha = 0
716719
} else if let itemIdentifier = controller.itemIdentifier(for: elementIndexPath, kind: kind, at: .beforeUpdate),
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"images" : [
3+
{
4+
"filename" : "demo4.jpg",
5+
"idiom" : "universal"
6+
}
7+
],
8+
"info" : {
9+
"author" : "xcode",
10+
"version" : 1
11+
}
12+
}
Loading
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"images" : [
3+
{
4+
"filename" : "demo5.jpeg",
5+
"idiom" : "universal"
6+
}
7+
],
8+
"info" : {
9+
"author" : "xcode",
10+
"version" : 1
11+
}
12+
}
Loading
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"images" : [
3+
{
4+
"filename" : "demo6.jpeg",
5+
"idiom" : "universal"
6+
}
7+
],
8+
"info" : {
9+
"author" : "xcode",
10+
"version" : 1
11+
}
12+
}
Loading
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"images" : [
3+
{
4+
"filename" : "demo7.jpeg",
5+
"idiom" : "universal"
6+
}
7+
],
8+
"info" : {
9+
"author" : "xcode",
10+
"version" : 1
11+
}
12+
}
Loading

0 commit comments

Comments
 (0)