mirror of
https://github.com/mastodon/mastodon-ios
synced 2025-04-11 22:58:02 +02:00

* Remove unused code (IOS-254) * Don't hide pill immediately every single time (IOS-254) * Check if there's something to scroll to (IOS-254) As the cause for the crash seems to be clear (scrolling to an indexPath that doesn't exist -> crash) we could check for the indexPath to exist. * Remove unused code * Only cache my timeline (IOS-254)
31 lines
915 B
Swift
31 lines
915 B
Swift
//
|
|
// UITableView.swift
|
|
// Mastodon
|
|
//
|
|
// Created by Cirno MainasuK on 2021-3-2.
|
|
//
|
|
|
|
import UIKit
|
|
import MastodonAsset
|
|
import MastodonLocalization
|
|
|
|
extension UITableView {
|
|
|
|
func deselectRow(with transitionCoordinator: UIViewControllerTransitionCoordinator?, animated: Bool) {
|
|
guard let indexPathForSelectedRow = indexPathForSelectedRow else { return }
|
|
|
|
guard let transitionCoordinator = transitionCoordinator else {
|
|
deselectRow(at: indexPathForSelectedRow, animated: animated)
|
|
return
|
|
}
|
|
|
|
transitionCoordinator.animate(alongsideTransition: { _ in
|
|
self.deselectRow(at: indexPathForSelectedRow, animated: animated)
|
|
}, completion: { context in
|
|
if context.isCancelled {
|
|
self.selectRow(at: indexPathForSelectedRow, animated: animated, scrollPosition: .none)
|
|
}
|
|
})
|
|
}
|
|
}
|