mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-21 22:03:37 +00:00
To expand with full Organic Maps and Maps.ME commits history run: git remote add om-historic [om-historic.git repo url] git fetch --tags om-historic git replace squashed-history historic-commits
32 lines
868 B
Swift
32 lines
868 B
Swift
final class RouteManagerTableView: UITableView {
|
|
@IBOutlet private weak var tableViewHeight: NSLayoutConstraint!
|
|
|
|
enum HeightUpdateStyle {
|
|
case animated
|
|
case deferred
|
|
case off
|
|
}
|
|
|
|
var heightUpdateStyle = HeightUpdateStyle.deferred
|
|
|
|
private var scheduledUpdate: DispatchWorkItem?
|
|
|
|
override var contentSize: CGSize {
|
|
didSet {
|
|
guard contentSize != oldValue else { return }
|
|
scheduledUpdate?.cancel()
|
|
let update = { [weak self] in
|
|
guard let s = self else { return }
|
|
s.tableViewHeight.constant = s.contentSize.height
|
|
}
|
|
switch heightUpdateStyle {
|
|
case .animated: superview?.animateConstraints(animations: update)
|
|
case .deferred:
|
|
scheduledUpdate = DispatchWorkItem(block: update)
|
|
DispatchQueue.main.async(execute: scheduledUpdate!)
|
|
case .off: break
|
|
}
|
|
}
|
|
}
|
|
}
|