1
0
mirror of https://git.zx2c4.com/wireguard-apple synced 2025-08-12 17:52:53 +00:00
Files
wireguard-apple/Sources/WireGuardApp/UI/macOS/NSTableView+Reuse.swift
Jason A. Donenfeld 7b279383d1 App: bump copyright
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-02-15 14:20:35 +01:00

18 lines
535 B
Swift

// SPDX-License-Identifier: MIT
// Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import Cocoa
extension NSTableView {
func dequeueReusableCell<T: NSView>() -> T {
let identifier = NSUserInterfaceItemIdentifier(NSStringFromClass(T.self))
if let cellView = makeView(withIdentifier: identifier, owner: self) {
// swiftlint:disable:next force_cast
return cellView as! T
}
let cellView = T()
cellView.identifier = identifier
return cellView
}
}