Skip to content

Instantly share code, notes, and snippets.

@acwright
Last active December 18, 2019 17:27
Show Gist options
  • Save acwright/75b529605d8512c093cb70fb6d9b042d to your computer and use it in GitHub Desktop.
Save acwright/75b529605d8512c093cb70fb6d9b042d to your computer and use it in GitHub Desktop.
import Cocoa
import SwiftUI
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
var popover: NSPopover!
func applicationDidFinishLaunching(_ aNotification: Notification) {
// Create the SwiftUI view that provides the window contents.
let contentView = ContentView()
// Create the popover
let popover = NSPopover()
popover.contentSize = NSSize(width: 400, height: 500)
popover.behavior = .transient
popover.contentViewController = NSHostingController(rootView: contentView)
self.popover = popover
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment