From 1b42cd781693947a128baf56997de4244f7f91ef Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Tue, 26 Sep 2023 09:18:01 -0400 Subject: [PATCH] Fix cell reuse bug with follow/action notifications --- .../ActionNotificationGroupCollectionViewCell.swift | 4 ++-- .../FollowNotificationGroupCollectionViewCell.swift | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Tusker/Screens/Notifications/ActionNotificationGroupCollectionViewCell.swift b/Tusker/Screens/Notifications/ActionNotificationGroupCollectionViewCell.swift index 5efea38ed9..447cca454d 100644 --- a/Tusker/Screens/Notifications/ActionNotificationGroupCollectionViewCell.swift +++ b/Tusker/Screens/Notifications/ActionNotificationGroupCollectionViewCell.swift @@ -155,8 +155,8 @@ class ActionNotificationGroupCollectionViewCell: UICollectionViewListCell { } imageView.update(for: avatarURL) } - for imageView in avatarStack.arrangedSubviews.dropFirst(visibleAvatars.count) { - avatarStack.removeArrangedSubview(imageView) + while avatarStack.arrangedSubviews.count > visibleAvatars.count { + avatarStack.arrangedSubviews.last!.removeFromSuperview() } actionLabel.setEmojis(pairs: people.map { ($0.displayOrUserName, $0.emojis) }, identifier: group.id) diff --git a/Tusker/Screens/Notifications/FollowNotificationGroupCollectionViewCell.swift b/Tusker/Screens/Notifications/FollowNotificationGroupCollectionViewCell.swift index 849357c3e5..d8013ff9e1 100644 --- a/Tusker/Screens/Notifications/FollowNotificationGroupCollectionViewCell.swift +++ b/Tusker/Screens/Notifications/FollowNotificationGroupCollectionViewCell.swift @@ -132,8 +132,8 @@ class FollowNotificationGroupCollectionViewCell: UICollectionViewListCell { } imageView.update(for: avatarURL) } - for imageView in avatarStack.arrangedSubviews.dropFirst(visibleAvatars.count) { - avatarStack.removeArrangedSubview(imageView) + while avatarStack.arrangedSubviews.count > visibleAvatars.count { + avatarStack.arrangedSubviews.last!.removeFromSuperview() } }