This commit is contained in:
David Roman 2023-06-03 18:59:03 +01:00
parent 334801e5de
commit 4db85b6430
No known key found for this signature in database
GPG Key ID: 7058646EEFCB70A7
1 changed files with 7 additions and 9 deletions

View File

@ -13,16 +13,14 @@ enum TestUtils {
}
#elseif canImport(AppKit)
enum TestUtils {
static func present(view: some View) {
let window = NSWindow(
contentRect: NSRect(x: 0, y: 0, width: 480, height: 300),
styleMask: [.titled, .closable, .miniaturizable, .resizable, .fullSizeContentView],
backing: .buffered,
defer: true
)
private static let window = NSWindow(
contentRect: NSRect(x: 0, y: 0, width: 480, height: 300),
styleMask: [.titled, .closable, .miniaturizable, .resizable, .fullSizeContentView],
backing: .buffered,
defer: true
)
window.center()
window.setFrameAutosaveName("Main Window")
static func present(view: some View) {
window.contentView = NSHostingView(rootView: view)
window.makeKeyAndOrderFront(nil)
window.layoutIfNeeded()