2019-01-01 19:37:46 +00:00
|
|
|
// SPDX-License-Identifier: MIT
|
2023-02-14 15:10:32 +00:00
|
|
|
// Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
|
2019-01-01 19:37:46 +00:00
|
|
|
|
|
|
|
import Cocoa
|
|
|
|
|
|
|
|
extension NSTableView {
|
|
|
|
func dequeueReusableCell<T: NSView>() -> T {
|
|
|
|
let identifier = NSUserInterfaceItemIdentifier(NSStringFromClass(T.self))
|
|
|
|
if let cellView = makeView(withIdentifier: identifier, owner: self) {
|
2021-08-02 08:19:47 +00:00
|
|
|
// swiftlint:disable:next force_cast
|
2019-01-01 19:37:46 +00:00
|
|
|
return cellView as! T
|
|
|
|
}
|
|
|
|
let cellView = T()
|
|
|
|
cellView.identifier = identifier
|
|
|
|
return cellView
|
|
|
|
}
|
|
|
|
}
|