Contents

codeeditapp/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 sup

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() })
                }
            }
        )
    }
}

<details><summary>Examples from real apps!</summary>

| CodeEdit | [CodeEdit Demo Image] | | ---------------------------------------------------------- | -------------------------------------------------------- | | CircuitPro | [CircuitPro Demo Image] |

</details>

License

Licensed under the MIT license

Package Metadata

Repository: codeeditapp/welcomewindow

Default branch: main

README: README.md