Skip to content

Commit

Permalink
Add NSViewControllerPreview for Cocoa.
Browse files Browse the repository at this point in the history
  • Loading branch information
Toni77777 committed Oct 15, 2021
1 parent 1eb7aca commit 0ba74ae
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
33 changes: 33 additions & 0 deletions Sources/PreviewDevice/CocoaPreivew/NSViewControllerPreview.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//
// NSViewControllerPreview.swift
//
//
// Created by Anton Paliakou on 10/15/21.
//

#if canImport(Cocoa) && canImport(SwiftUI)
import SwiftUI
import Cocoa

public struct NSViewControllerPreview: NSViewControllerRepresentable {

// MARK: - Properties

private let viewController: NSViewController

// MARK: - Init

public init(viewController: NSViewController) {
self.viewController = viewController
}

// MARK: - UIViewControllerRepresentable

public func makeNSViewController(context: Context) -> NSViewController {
viewController
}

public func updateNSViewController(_ nsViewController: NSViewController, context: Context) {
}
}
#endif
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// File.swift
// UIViewControllerPreview.swift
//
//
// Created by Anton Paliakou on 10/15/21.
Expand Down

0 comments on commit 0ba74ae

Please sign in to comment.