-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add NSViewControllerPreview for Cocoa.
- Loading branch information
Showing
2 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
Sources/PreviewDevice/CocoaPreivew/NSViewControllerPreview.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
2 changes: 1 addition & 1 deletion
2
Sources/PreviewDevice/UIKitPreview/UIViewControllerPreview.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | ||
|