blob: 6579f8863478b78b0d1c0a1684b581069d0aba07 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
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() {
}
}
|