From 8e69090ea4b110a2d16437341de453bf122c3d2a Mon Sep 17 00:00:00 2001 From: Anton Heestand Date: Sun, 20 Jun 2021 20:02:09 +0200 Subject: [PATCH] PixelView --- Source/PIX/View/PIXView.swift | 2 -- Source/PIX/View/PixelView.swift | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 Source/PIX/View/PixelView.swift diff --git a/Source/PIX/View/PIXView.swift b/Source/PIX/View/PIXView.swift index d7e0676b..10cf30ff 100644 --- a/Source/PIX/View/PIXView.swift +++ b/Source/PIX/View/PIXView.swift @@ -9,8 +9,6 @@ import MetalKit import RenderKit import Resolution -public typealias PixelView = NODERepView - public class PIXView: NODEView { #if os(iOS) diff --git a/Source/PIX/View/PixelView.swift b/Source/PIX/View/PixelView.swift new file mode 100644 index 00000000..8605cecd --- /dev/null +++ b/Source/PIX/View/PixelView.swift @@ -0,0 +1,32 @@ +// +// PixelView.swift +// +// +// Created by Anton Heestand on 2021-06-20. +// + +import SwiftUI + +#if os(macOS) +public struct PixelView: NSViewRepresentable { + private let pix: PIX + public init(pix: PIX) { + self.pix = pix + } + public func makeNSView(context: Context) -> PIXView { + pix.pixView + } + public func updateNSView(_ pixView: PIXView, context: Context) {} +} +#else +public struct PixelView: UIViewRepresentable { + private let pix: PIX + public init(pix: PIX) { + self.pix = pix + } + public func makeUIView(context: Context) -> PIXView { + pix.pixView + } + public func updateUIView(_ pixView: PIXView, context: Context) {} +} +#endif