Skip to content

Commit d0edb6f

Browse files
author
Eugene Kazaev
committed
Attepmt to fix IOS 15.1 issue.
See: https://feedbackassistant.apple.com/feedback/9727104
1 parent 02c4972 commit d0edb6f

File tree

67 files changed

+216
-131
lines changed

Some content is hidden

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

67 files changed

+216
-131
lines changed

ChatLayout.podspec

+1-1
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 = '1.1.13'
3+
s.version = '1.1.14'
44
s.summary = 'Chat UI Library. It uses custom UICollectionViewLayout to provide you full control over the presentation.'
55
s.swift_version = '5.2'
66

ChatLayout/Classes/Core/ChatLayout.swift

+29-2
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,11 @@ public final class ChatLayout: UICollectionViewLayout {
112112
return contentSize
113113
}
114114

115+
/// There is an issue in IOS 15.1 that proposed content offset is being ignored by the UICollectionView when user is scrolling.
116+
/// This flag enables a hack to compensate this offset later. You can disable it if necessary.
117+
/// Bug reported: https://feedbackassistant.apple.com/feedback/9727104
118+
public var enableIOS15_1Fix: Bool = true
119+
115120
// MARK: Internal Properties
116121

117122
var adjustedContentInset: UIEdgeInsets {
@@ -175,6 +180,12 @@ public final class ChatLayout: UICollectionViewLayout {
175180

176181
private let _flipsHorizontallyInOppositeLayoutDirection: Bool
177182

183+
// MARK: IOS 15.1 fix flags
184+
185+
private var needsIOS15_1IssueFix: Bool {
186+
return enableIOS15_1Fix && isIOS15_1orHigher && isUserInitiatedScrolling && !controller.isAnimatedBoundsChange
187+
}
188+
178189
// MARK: Constructors
179190

180191
/// Default constructor.
@@ -609,9 +620,16 @@ public final class ChatLayout: UICollectionViewLayout {
609620
let collectionView = collectionView {
610621
let minPossibleContentOffset = -collectionView.adjustedContentInset.top
611622
let newProposedContentOffset = CGPoint(x: proposedContentOffset.x, y: max(minPossibleContentOffset, min(proposedContentOffset.y + controller.proposedCompensatingOffset, maxPossibleContentOffset.y)))
612-
controller.proposedCompensatingOffset = 0
613623
invalidationActions.formUnion([.shouldInvalidateOnBoundsChange])
614-
return newProposedContentOffset
624+
if needsIOS15_1IssueFix {
625+
// This fix affects performance as UICollectionView will request cells event though they wont be visible on the screen.
626+
// It also causes a small flickering as content offset is being fixed at `finalizeCollectionViewUpdates` instead.
627+
controller.batchUpdateCompensatingOffset += controller.proposedCompensatingOffset
628+
return super.targetContentOffset(forProposedContentOffset: proposedContentOffset)
629+
} else {
630+
controller.proposedCompensatingOffset = 0
631+
return newProposedContentOffset
632+
}
615633
}
616634
return super.targetContentOffset(forProposedContentOffset: proposedContentOffset)
617635
}
@@ -949,3 +967,12 @@ var isIOS13orHigher: Bool {
949967
return false
950968
}
951969
}
970+
971+
@inline(__always)
972+
var isIOS15_1orHigher: Bool {
973+
if #available(iOS 15.1, *) {
974+
return true
975+
} else {
976+
return false
977+
}
978+
}

Example/Podfile.lock

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
PODS:
2-
- ChatLayout (1.1.13):
3-
- ChatLayout/Ultimate (= 1.1.13)
4-
- ChatLayout/Core (1.1.13)
5-
- ChatLayout/Extras (1.1.13):
2+
- ChatLayout (1.1.14):
3+
- ChatLayout/Ultimate (= 1.1.14)
4+
- ChatLayout/Core (1.1.14)
5+
- ChatLayout/Extras (1.1.14):
66
- ChatLayout/Core
7-
- ChatLayout/Ultimate (1.1.13):
7+
- ChatLayout/Ultimate (1.1.14):
88
- ChatLayout/Core
99
- ChatLayout/Extras
1010
- DifferenceKit (1.2.0):
@@ -35,7 +35,7 @@ EXTERNAL SOURCES:
3535
:path: "../"
3636

3737
SPEC CHECKSUMS:
38-
ChatLayout: 3043e079e1b2e46239fc2f33bcbd3e679f1314cc
38+
ChatLayout: 19b41ab293c2e3a07e79069506816c235cb51901
3939
DifferenceKit: 5659c430bb7fe45876fa32ce5cba5d6167f0c805
4040
FPSCounter: 884afec377de66637808c4f52ecc3b85a404732b
4141
InputBarAccessoryView: 74d471ab1fa1736806be50328df79257e52865a9

docs/Classes/CellLayoutContainerView.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<header class="header">
2222
<p class="header-col header-col--primary">
2323
<a class="header-link" href="../index.html">
24-
ChatLayout 1.1.10 Docs
24+
ChatLayout 1.1.14 Docs
2525
</a>
2626
(100% documented)
2727
</p>
@@ -457,7 +457,7 @@ <h4>Parameters</h4>
457457
</article>
458458
</div>
459459
<section class="footer">
460-
<p>&copy; 2021 <a class="link" href="https://github.com/ekazaev" target="_blank" rel="external noopener">Evgeny Kazaev</a>. All rights reserved. (Last updated: 2021-10-07)</p>
460+
<p>&copy; 2021 <a class="link" href="https://github.com/ekazaev" target="_blank" rel="external noopener">Evgeny Kazaev</a>. All rights reserved. (Last updated: 2021-10-28)</p>
461461
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.1</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
462462
</section>
463463
</body>

docs/Classes/ChatLayout.html

+31-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<header class="header">
2222
<p class="header-col header-col--primary">
2323
<a class="header-link" href="../index.html">
24-
ChatLayout 1.1.10 Docs
24+
ChatLayout 1.1.14 Docs
2525
</a>
2626
(100% documented)
2727
</p>
@@ -481,6 +481,35 @@ <h4>Declaration</h4>
481481
</section>
482482
</div>
483483
</li>
484+
<li class="item">
485+
<div>
486+
<code>
487+
<a name="/s:10ChatLayoutAAC16enableIOS15_1FixSbvp"></a>
488+
<a name="//apple_ref/swift/Property/enableIOS15_1Fix" class="dashAnchor"></a>
489+
<a class="token" href="#/s:10ChatLayoutAAC16enableIOS15_1FixSbvp">enableIOS15_1Fix</a>
490+
</code>
491+
</div>
492+
<div class="height-container">
493+
<div class="pointer-container"></div>
494+
<section class="section">
495+
<div class="pointer"></div>
496+
<div class="abstract">
497+
<p>There is an issue in IOS 15.1 that proposed content offset is being ignored by the UICollectionView when user is scrolling.
498+
This flag enables a hack to compensate this offset later. You can disable it if necessary.
499+
Bug reported: <a href="https://feedbackassistant.apple.com/feedback/9727104">https://feedbackassistant.apple.com/feedback/9727104</a></p>
500+
501+
</div>
502+
<div class="declaration">
503+
<h4>Declaration</h4>
504+
<div class="language">
505+
<p class="aside-title">Swift</p>
506+
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">enableIOS15_1Fix</span><span class="p">:</span> <span class="kt">Bool</span></code></pre>
507+
508+
</div>
509+
</div>
510+
</section>
511+
</div>
512+
</li>
484513
</ul>
485514
</div>
486515
<div class="task-group">
@@ -1277,7 +1306,7 @@ <h4>Declaration</h4>
12771306
</article>
12781307
</div>
12791308
<section class="footer">
1280-
<p>&copy; 2021 <a class="link" href="https://github.com/ekazaev" target="_blank" rel="external noopener">Evgeny Kazaev</a>. All rights reserved. (Last updated: 2021-10-07)</p>
1309+
<p>&copy; 2021 <a class="link" href="https://github.com/ekazaev" target="_blank" rel="external noopener">Evgeny Kazaev</a>. All rights reserved. (Last updated: 2021-10-28)</p>
12811310
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.1</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
12821311
</section>
12831312
</body>

docs/Classes/ChatLayoutAttributes.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<header class="header">
2222
<p class="header-col header-col--primary">
2323
<a class="header-link" href="../index.html">
24-
ChatLayout 1.1.10 Docs
24+
ChatLayout 1.1.14 Docs
2525
</a>
2626
(100% documented)
2727
</p>
@@ -416,7 +416,7 @@ <h4>Declaration</h4>
416416
</article>
417417
</div>
418418
<section class="footer">
419-
<p>&copy; 2021 <a class="link" href="https://github.com/ekazaev" target="_blank" rel="external noopener">Evgeny Kazaev</a>. All rights reserved. (Last updated: 2021-10-07)</p>
419+
<p>&copy; 2021 <a class="link" href="https://github.com/ekazaev" target="_blank" rel="external noopener">Evgeny Kazaev</a>. All rights reserved. (Last updated: 2021-10-28)</p>
420420
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.1</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
421421
</section>
422422
</body>

docs/Classes/ChatLayoutInvalidationContext.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<header class="header">
2222
<p class="header-col header-col--primary">
2323
<a class="header-link" href="../index.html">
24-
ChatLayout 1.1.10 Docs
24+
ChatLayout 1.1.14 Docs
2525
</a>
2626
(100% documented)
2727
</p>
@@ -201,7 +201,7 @@ <h4>Declaration</h4>
201201
</article>
202202
</div>
203203
<section class="footer">
204-
<p>&copy; 2021 <a class="link" href="https://github.com/ekazaev" target="_blank" rel="external noopener">Evgeny Kazaev</a>. All rights reserved. (Last updated: 2021-10-07)</p>
204+
<p>&copy; 2021 <a class="link" href="https://github.com/ekazaev" target="_blank" rel="external noopener">Evgeny Kazaev</a>. All rights reserved. (Last updated: 2021-10-28)</p>
205205
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.1</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
206206
</section>
207207
</body>

docs/Classes/ContainerCollectionReusableView.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<header class="header">
2222
<p class="header-col header-col--primary">
2323
<a class="header-link" href="../index.html">
24-
ChatLayout 1.1.10 Docs
24+
ChatLayout 1.1.14 Docs
2525
</a>
2626
(100% documented)
2727
</p>
@@ -377,7 +377,7 @@ <h4>Parameters</h4>
377377
</article>
378378
</div>
379379
<section class="footer">
380-
<p>&copy; 2021 <a class="link" href="https://github.com/ekazaev" target="_blank" rel="external noopener">Evgeny Kazaev</a>. All rights reserved. (Last updated: 2021-10-07)</p>
380+
<p>&copy; 2021 <a class="link" href="https://github.com/ekazaev" target="_blank" rel="external noopener">Evgeny Kazaev</a>. All rights reserved. (Last updated: 2021-10-28)</p>
381381
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.1</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
382382
</section>
383383
</body>

docs/Classes/ContainerCollectionViewCell.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<header class="header">
2222
<p class="header-col header-col--primary">
2323
<a class="header-link" href="../index.html">
24-
ChatLayout 1.1.10 Docs
24+
ChatLayout 1.1.14 Docs
2525
</a>
2626
(100% documented)
2727
</p>
@@ -377,7 +377,7 @@ <h4>Parameters</h4>
377377
</article>
378378
</div>
379379
<section class="footer">
380-
<p>&copy; 2021 <a class="link" href="https://github.com/ekazaev" target="_blank" rel="external noopener">Evgeny Kazaev</a>. All rights reserved. (Last updated: 2021-10-07)</p>
380+
<p>&copy; 2021 <a class="link" href="https://github.com/ekazaev" target="_blank" rel="external noopener">Evgeny Kazaev</a>. All rights reserved. (Last updated: 2021-10-28)</p>
381381
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.1</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
382382
</section>
383383
</body>

docs/Classes/EdgeAligningView.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<header class="header">
2222
<p class="header-col header-col--primary">
2323
<a class="header-link" href="../index.html">
24-
ChatLayout 1.1.10 Docs
24+
ChatLayout 1.1.14 Docs
2525
</a>
2626
(100% documented)
2727
</p>
@@ -361,7 +361,7 @@ <h4>Parameters</h4>
361361
</article>
362362
</div>
363363
<section class="footer">
364-
<p>&copy; 2021 <a class="link" href="https://github.com/ekazaev" target="_blank" rel="external noopener">Evgeny Kazaev</a>. All rights reserved. (Last updated: 2021-10-07)</p>
364+
<p>&copy; 2021 <a class="link" href="https://github.com/ekazaev" target="_blank" rel="external noopener">Evgeny Kazaev</a>. All rights reserved. (Last updated: 2021-10-28)</p>
365365
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.1</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
366366
</section>
367367
</body>

docs/Classes/EdgeAligningView/Edge.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<header class="header">
2222
<p class="header-col header-col--primary">
2323
<a class="header-link" href="../../index.html">
24-
ChatLayout 1.1.10 Docs
24+
ChatLayout 1.1.14 Docs
2525
</a>
2626
(100% documented)
2727
</p>
@@ -281,7 +281,7 @@ <h4>Declaration</h4>
281281
</article>
282282
</div>
283283
<section class="footer">
284-
<p>&copy; 2021 <a class="link" href="https://github.com/ekazaev" target="_blank" rel="external noopener">Evgeny Kazaev</a>. All rights reserved. (Last updated: 2021-10-07)</p>
284+
<p>&copy; 2021 <a class="link" href="https://github.com/ekazaev" target="_blank" rel="external noopener">Evgeny Kazaev</a>. All rights reserved. (Last updated: 2021-10-28)</p>
285285
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.1</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
286286
</section>
287287
</body>

docs/Classes/ImageMaskedView.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<header class="header">
2222
<p class="header-col header-col--primary">
2323
<a class="header-link" href="../index.html">
24-
ChatLayout 1.1.10 Docs
24+
ChatLayout 1.1.14 Docs
2525
</a>
2626
(100% documented)
2727
</p>
@@ -401,7 +401,7 @@ <h4>Declaration</h4>
401401
</article>
402402
</div>
403403
<section class="footer">
404-
<p>&copy; 2021 <a class="link" href="https://github.com/ekazaev" target="_blank" rel="external noopener">Evgeny Kazaev</a>. All rights reserved. (Last updated: 2021-10-07)</p>
404+
<p>&copy; 2021 <a class="link" href="https://github.com/ekazaev" target="_blank" rel="external noopener">Evgeny Kazaev</a>. All rights reserved. (Last updated: 2021-10-28)</p>
405405
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.1</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
406406
</section>
407407
</body>

docs/Classes/MessageContainerView.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<header class="header">
2222
<p class="header-col header-col--primary">
2323
<a class="header-link" href="../index.html">
24-
ChatLayout 1.1.10 Docs
24+
ChatLayout 1.1.14 Docs
2525
</a>
2626
(100% documented)
2727
</p>
@@ -347,7 +347,7 @@ <h4>Parameters</h4>
347347
</article>
348348
</div>
349349
<section class="footer">
350-
<p>&copy; 2021 <a class="link" href="https://github.com/ekazaev" target="_blank" rel="external noopener">Evgeny Kazaev</a>. All rights reserved. (Last updated: 2021-10-07)</p>
350+
<p>&copy; 2021 <a class="link" href="https://github.com/ekazaev" target="_blank" rel="external noopener">Evgeny Kazaev</a>. All rights reserved. (Last updated: 2021-10-28)</p>
351351
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.1</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
352352
</section>
353353
</body>

docs/Classes/RoundedCornersContainerView.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<header class="header">
2222
<p class="header-col header-col--primary">
2323
<a class="header-link" href="../index.html">
24-
ChatLayout 1.1.10 Docs
24+
ChatLayout 1.1.14 Docs
2525
</a>
2626
(100% documented)
2727
</p>
@@ -347,7 +347,7 @@ <h4>Declaration</h4>
347347
</article>
348348
</div>
349349
<section class="footer">
350-
<p>&copy; 2021 <a class="link" href="https://github.com/ekazaev" target="_blank" rel="external noopener">Evgeny Kazaev</a>. All rights reserved. (Last updated: 2021-10-07)</p>
350+
<p>&copy; 2021 <a class="link" href="https://github.com/ekazaev" target="_blank" rel="external noopener">Evgeny Kazaev</a>. All rights reserved. (Last updated: 2021-10-28)</p>
351351
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.1</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
352352
</section>
353353
</body>

docs/Core.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<header class="header">
2222
<p class="header-col header-col--primary">
2323
<a class="header-link" href="index.html">
24-
ChatLayout 1.1.10 Docs
24+
ChatLayout 1.1.14 Docs
2525
</a>
2626
(100% documented)
2727
</p>
@@ -435,7 +435,7 @@ <h4>Declaration</h4>
435435
</article>
436436
</div>
437437
<section class="footer">
438-
<p>&copy; 2021 <a class="link" href="https://github.com/ekazaev" target="_blank" rel="external noopener">Evgeny Kazaev</a>. All rights reserved. (Last updated: 2021-10-07)</p>
438+
<p>&copy; 2021 <a class="link" href="https://github.com/ekazaev" target="_blank" rel="external noopener">Evgeny Kazaev</a>. All rights reserved. (Last updated: 2021-10-28)</p>
439439
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.1</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
440440
</section>
441441
</body>

docs/Enums/CellLayoutContainerViewAlignment.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<header class="header">
2222
<p class="header-col header-col--primary">
2323
<a class="header-link" href="../index.html">
24-
ChatLayout 1.1.10 Docs
24+
ChatLayout 1.1.14 Docs
2525
</a>
2626
(100% documented)
2727
</p>
@@ -281,7 +281,7 @@ <h4>Declaration</h4>
281281
</article>
282282
</div>
283283
<section class="footer">
284-
<p>&copy; 2021 <a class="link" href="https://github.com/ekazaev" target="_blank" rel="external noopener">Evgeny Kazaev</a>. All rights reserved. (Last updated: 2021-10-07)</p>
284+
<p>&copy; 2021 <a class="link" href="https://github.com/ekazaev" target="_blank" rel="external noopener">Evgeny Kazaev</a>. All rights reserved. (Last updated: 2021-10-28)</p>
285285
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.1</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
286286
</section>
287287
</body>

docs/Enums/ChatItemAlignment.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<header class="header">
2222
<p class="header-col header-col--primary">
2323
<a class="header-link" href="../index.html">
24-
ChatLayout 1.1.10 Docs
24+
ChatLayout 1.1.14 Docs
2525
</a>
2626
(100% documented)
2727
</p>
@@ -281,7 +281,7 @@ <h4>Declaration</h4>
281281
</article>
282282
</div>
283283
<section class="footer">
284-
<p>&copy; 2021 <a class="link" href="https://github.com/ekazaev" target="_blank" rel="external noopener">Evgeny Kazaev</a>. All rights reserved. (Last updated: 2021-10-07)</p>
284+
<p>&copy; 2021 <a class="link" href="https://github.com/ekazaev" target="_blank" rel="external noopener">Evgeny Kazaev</a>. All rights reserved. (Last updated: 2021-10-28)</p>
285285
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.1</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
286286
</section>
287287
</body>

0 commit comments

Comments
 (0)