A highly customizable welcome window built for macOS applications. This package supports NSDocument-based apps and offers the ability to override the recent list for other use cases. It's designed to provide a native and elegant welcome experience for your app at launch, with support for new/open document actions, drag-and-drop functionality, and dynamic layouts.
This package is fully documented here.
To use welcome window, simply import the package
import WelcomeWindow
And add it as a window in your SwiftUI App.
@main struct CodeEditApp: App { @Environment(\.dismiss) private var dismiss var body: some Scene { WelcomeWindow( // Add two action buttons below your icon actions: { dismiss in WelcomeButton( iconName: "circle.fill", title: "New Text Document", action: { NSDocumentController.shared.createFileDocumentWithDialog( configuration: .init(title: "Create new text document"), onCompletion: { dismiss() } ) } ) WelcomeButton( iconName: "triangle.fill", title: "Open Text Document or Folder", action: { NSDocumentController.shared.openDocumentWithDialog( configuration: .init(canChooseDirectories: true), onDialogPresented: { dismiss() }, onCancel: { openWindow(id: "welcome") } ) } ) }, // Receive files via drag and drop onDrop: { url, dismiss in print("File dropped at: \(url.path)") Task { NSDocumentController.shared.openDocument(at: url, onCompletion: { dismiss() }) } } ) } }
Examples from real apps!
CodeEdit | ![]() |
---|---|
CircuitPro | ![]() |
Licensed under the MIT license