diff options
Diffstat (limited to 'WireGuard/WireGuard/UI/iOS/UITableViewCell+Reuse.swift')
-rw-r--r-- | WireGuard/WireGuard/UI/iOS/UITableViewCell+Reuse.swift | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/WireGuard/WireGuard/UI/iOS/UITableViewCell+Reuse.swift b/WireGuard/WireGuard/UI/iOS/UITableViewCell+Reuse.swift new file mode 100644 index 0000000..587f7b1 --- /dev/null +++ b/WireGuard/WireGuard/UI/iOS/UITableViewCell+Reuse.swift @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: MIT +// Copyright © 2018 WireGuard LLC. All Rights Reserved. + +import UIKit + +extension UITableViewCell { + static var reuseIdentifier: String { + return NSStringFromClass(self) + } +} + +extension UITableView { + func register<T: UITableViewCell>(_: T.Type) { + register(T.self, forCellReuseIdentifier: T.reuseIdentifier) + } + + func dequeueReusableCell<T: UITableViewCell>(for indexPath: IndexPath) -> T { + //swiftlint:disable:next force_cast + return dequeueReusableCell(withIdentifier: T.reuseIdentifier, for: indexPath) as! T + } +} |