session-ios/SessionUtilitiesKit/General/UITableView+ReusableView.swift
Morgan Pretty 32304ae5dd Cleared out some of the legacy serialisation logic, further UI binding
Refactored the SignalApp class to Swift
Fixed a horizontal alignment issue in the ConversationTitleView
Fixed an issue where expiration timer update messages weren't migrated or rendering correctly
Fixed an issue where expiring messages weren't migrated correctly
Fixed an issue where closed groups which had been left were causing migration failures (due to data incorrectly being assumed to be required)
Shifted the Legacy Attachment types into the 'SMKLegacy' namespace
Moved all of the NSCoding logic for the TSMessage
2022-05-03 17:14:56 +10:00

28 lines
1.3 KiB
Swift

// Copyright © 2022 Rangeproof Pty Ltd. All rights reserved.
import UIKit
public extension UITableView {
func register<View>(view: View.Type) where View: UITableViewCell {
register(view.self, forCellReuseIdentifier: view.defaultReuseIdentifier)
}
func registerHeaderFooterView<View>(view: View.Type) where View: UITableViewHeaderFooterView {
register(view.self, forHeaderFooterViewReuseIdentifier: view.defaultReuseIdentifier)
}
func dequeue<T>(type: T.Type, for indexPath: IndexPath) -> T where T: UITableViewCell {
// Note: We need to use `type.defaultReuseIdentifier` rather than `T.defaultReuseIdentifier`
// otherwise we may get a subclass rather than the actual type we specified
let reuseIdentifier = type.defaultReuseIdentifier
return dequeueReusableCell(withIdentifier: reuseIdentifier, for: indexPath) as! T
}
func dequeueHeaderFooterView<T>(type: T.Type) -> T where T: UITableViewHeaderFooterView {
// Note: We need to use `type.defaultReuseIdentifier` rather than `T.defaultReuseIdentifier`
// otherwise we may get a subclass rather than the actual type we specified
let reuseIdentifier = type.defaultReuseIdentifier
return dequeueReusableHeaderFooterView(withIdentifier: reuseIdentifier) as! T
}
}