ghostty/macos/Sources/Features/Paste Protection/PasteProtectionController.swift
2023-11-04 20:47:16 -07:00

30 lines
780 B
Swift

import Foundation
import Cocoa
import SwiftUI
import GhosttyKit
class PasteProtectionController: NSWindowController {
override var windowNibName: NSNib.Name? { "PasteProtection" }
weak private var delegate: PasteProtectionViewDelegate? = nil
init(delegate: PasteProtectionViewDelegate) {
self.delegate = delegate
super.init(window: nil)
}
required init?(coder: NSCoder) {
fatalError("init(coder:) is not supported for this view")
}
//MARK: - NSWindowController
override func windowDidLoad() {
guard let window = window else { return }
window.contentView = NSHostingView(rootView: PasteProtectionView(
contents: "Hello",
delegate: delegate
))
}
}