Remove workaround for tableviews

This commit is contained in:
Nathan Mattes 2022-12-17 21:57:17 +01:00
parent af2cf75c56
commit 2cdd8af7c3
13 changed files with 11 additions and 40 deletions

View File

@ -307,7 +307,6 @@
DB72602725E36A6F00235243 /* MastodonServerRulesViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB72602625E36A6F00235243 /* MastodonServerRulesViewModel.swift */; };
DB7274F4273BB9B200577D95 /* ListBatchFetchViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB7274F3273BB9B200577D95 /* ListBatchFetchViewModel.swift */; };
DB73B490261F030A002E9E9F /* SafariActivity.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB73B48F261F030A002E9E9F /* SafariActivity.swift */; };
DB73BF4B27140C0800781945 /* UITableViewDiffableDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB73BF4A27140C0800781945 /* UITableViewDiffableDataSource.swift */; };
DB75BF1E263C1C1B00EDBF1F /* CustomScheduler.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB75BF1D263C1C1B00EDBF1F /* CustomScheduler.swift */; };
DB789A0B25F9F2950071ACA0 /* ComposeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB789A0A25F9F2950071ACA0 /* ComposeViewController.swift */; };
DB789A1225F9F2CC0071ACA0 /* ComposeViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB789A1125F9F2CC0071ACA0 /* ComposeViewModel.swift */; };
@ -880,7 +879,6 @@
DB72602625E36A6F00235243 /* MastodonServerRulesViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MastodonServerRulesViewModel.swift; sourceTree = "<group>"; };
DB7274F3273BB9B200577D95 /* ListBatchFetchViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListBatchFetchViewModel.swift; sourceTree = "<group>"; };
DB73B48F261F030A002E9E9F /* SafariActivity.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SafariActivity.swift; sourceTree = "<group>"; };
DB73BF4A27140C0800781945 /* UITableViewDiffableDataSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UITableViewDiffableDataSource.swift; sourceTree = "<group>"; };
DB75BF1D263C1C1B00EDBF1F /* CustomScheduler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomScheduler.swift; sourceTree = "<group>"; };
DB789A0A25F9F2950071ACA0 /* ComposeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ComposeViewController.swift; sourceTree = "<group>"; };
DB789A1125F9F2CC0071ACA0 /* ComposeViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ComposeViewModel.swift; sourceTree = "<group>"; };
@ -2283,7 +2281,6 @@
DB9E0D6E25EE008500CFDD76 /* UIInterpolatingMotionEffect.swift */,
2AE244472927831100BDBF7C /* UIImage+SFSymbols.swift */,
DBCC3B2F261440A50045B23D /* UITabBarController.swift */,
DB73BF4A27140C0800781945 /* UITableViewDiffableDataSource.swift */,
2A1FE47D2938C11200784BF1 /* Collection+IsNotEmpty.swift */,
);
path = Extension;
@ -3406,7 +3403,6 @@
DB1E346825F518E20079D7DF /* CategoryPickerSection.swift in Sources */,
DB7274F4273BB9B200577D95 /* ListBatchFetchViewModel.swift in Sources */,
DB0618052785A73D0030EE79 /* RegisterItem.swift in Sources */,
DB73BF4B27140C0800781945 /* UITableViewDiffableDataSource.swift in Sources */,
DBB525642612C988002F1F29 /* MeProfileViewModel.swift in Sources */,
DB3EA8EF281B837000598866 /* DiscoveryCommunityViewController+DataSourceProvider.swift in Sources */,
DB6B74EF272FB55000C70B6E /* FollowerListViewController.swift in Sources */,

View File

@ -1,25 +0,0 @@
//
// UITableViewDiffableDataSource.swift
// Mastodon
//
// Created by Cirno MainasuK on 2021-10-11.
//
import UIKit
// ref: https://www.jessesquires.com/blog/2021/07/08/diffable-data-source-behavior-changes-and-reconfiguring-cells-in-ios-15/
extension UITableViewDiffableDataSource {
func reloadData(
snapshot: NSDiffableDataSourceSnapshot<SectionIdentifierType, ItemIdentifierType>,
completion: (() -> Void)? = nil
) {
self.applySnapshotUsingReloadData(snapshot, completion: completion)
}
func applySnapshot(
_ snapshot: NSDiffableDataSourceSnapshot<SectionIdentifierType, ItemIdentifierType>,
animated: Bool,
completion: (() -> Void)? = nil) {
self.apply(snapshot, animatingDifferences: animated, completion: completion)
}
}

View File

@ -59,7 +59,7 @@ extension DiscoveryCommunityViewModel {
}
}
diffableDataSource.applySnapshot(snapshot, animated: false)
diffableDataSource.apply(snapshot, animatingDifferences: false)
}
.store(in: &disposeBag)
}

View File

@ -41,7 +41,7 @@ extension DiscoveryForYouViewModel {
let items = records.map { DiscoveryItem.user($0) }
snapshot.appendItems(items, toSection: .forYou)
diffableDataSource.applySnapshot(snapshot, animated: false)
diffableDataSource.apply(snapshot, animatingDifferences: false)
}
.store(in: &disposeBag)
}

View File

@ -52,7 +52,7 @@ extension DiscoveryNewsViewModel {
}
}
diffableDataSource.applySnapshot(snapshot, animated: false)
diffableDataSource.apply(snapshot, animatingDifferences: false)
}
.store(in: &disposeBag)
}

View File

@ -59,7 +59,7 @@ extension DiscoveryPostsViewModel {
}
}
diffableDataSource.applySnapshot(snapshot, animated: false)
diffableDataSource.apply(snapshot, animatingDifferences: false)
}
.store(in: &disposeBag)
}

View File

@ -271,7 +271,7 @@ extension MastodonLoginViewController: MastodonLoginViewModelDelegate {
snapshot.appendSections([MastodonLoginViewSection.servers])
snapshot.appendItems(viewModel.filteredServers)
dataSource?.applySnapshot(snapshot, animated: false)
dataSource?.apply(snapshot, animatingDifferences: false)
OperationQueue.main.addOperation {
let numberOfResults = viewModel.filteredServers.count

View File

@ -21,6 +21,6 @@ extension MastodonServerRulesViewModel {
return ServerRuleItem.rule(ruleContext)
}
snapshot.appendItems(ruleItems, toSection: .rules)
diffableDataSource?.applySnapshot(snapshot, animated: false, completion: nil)
diffableDataSource?.apply(snapshot, animatingDifferences: false)
}
}

View File

@ -59,7 +59,7 @@ extension BookmarkViewModel {
}
}
diffableDataSource.applySnapshot(snapshot, animated: false)
diffableDataSource.apply(snapshot, animatingDifferences: false)
}
.store(in: &disposeBag)
}

View File

@ -59,7 +59,7 @@ extension FavoriteViewModel {
}
}
diffableDataSource.applySnapshot(snapshot, animated: false)
diffableDataSource.apply(snapshot, animatingDifferences: false)
}
.store(in: &disposeBag)
}

View File

@ -47,7 +47,7 @@ final class FollowedTagsViewModel: NSObject {
var snapshot = NSDiffableDataSourceSnapshot<Section, Item>()
snapshot.appendSections([.main])
snapshot.appendItems(records.map {.hashtag($0) })
self.diffableDataSource?.applySnapshot(snapshot, animated: true)
self.diffableDataSource?.apply(snapshot, animatingDifferences: true)
}
.store(in: &disposeBag)
}

View File

@ -83,7 +83,7 @@ extension UserTimelineViewModel {
}
}
diffableDataSource.applySnapshot(snapshot, animated: false)
diffableDataSource.apply(snapshot, animatingDifferences: false)
}
.store(in: &disposeBag)
}

View File

@ -65,7 +65,7 @@ extension ReportStatusViewModel {
break
}
diffableDataSource.applySnapshot(snapshot, animated: false) { [weak self] in
diffableDataSource.apply(snapshot, animatingDifferences: false) { [weak self] in
guard let self = self else { return }
guard let diffableDataSource = self.diffableDataSource else { return }