mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-04-23 18:08:39 +03:00
27 lines
576 B
Swift
27 lines
576 B
Swift
import SwiftUI
|
|
import MetalKit
|
|
|
|
/// Renders an MTKView with the given renderer class.
|
|
struct MetalView<V: MTKView>: View {
|
|
@State private var metalView = V()
|
|
|
|
var body: some View {
|
|
MetalViewRepresentable(metalView: $metalView)
|
|
}
|
|
}
|
|
|
|
fileprivate struct MetalViewRepresentable<V: MTKView>: NSViewRepresentable {
|
|
@Binding var metalView: V
|
|
|
|
func makeNSView(context: Context) -> some NSView {
|
|
metalView
|
|
}
|
|
|
|
func updateNSView(_ view: NSViewType, context: Context) {
|
|
updateMetalView()
|
|
}
|
|
|
|
func updateMetalView() {
|
|
}
|
|
}
|