Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

CodeEditApp/WelcomeWindow

Repository files navigation

WelcomeWindow

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.

GitHub release Github Tests GitHub Repo stars GitHub forks Discord Badge

Demo Image

Documentation

This package is fully documented here.

Usage

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 CodeEdit Demo Image
CircuitPro CircuitPro Demo Image

License

Licensed under the MIT license

AltStyle によって変換されたページ (->オリジナル) /