Skip to content

CodeEditApp/CodeEditWelcomeWindow

Repository files navigation

WelcomeWindow

A highly customizable welcome window built for NSDocument-based macOS applications. Designed to provide a native and elegant welcome experience for your app at launch, with support for new/open document actions, drag-and-drop, and dynamic layouts.

GitHub release Github Tests Documentation GitHub Repo stars GitHub forks Discord Badge

image

Documentation

This package is fully documented here.

Usage

To use WelcomeWindow, simply add it to your app.

WelcomeWindow(
    actions: { dismiss in
        WelcomeActionView(
            iconName: "circle.fill",
            title: "New Text Document",
            action: {
                NSDocumentController.shared.createNewDocumentWithDialog(
                    configuration: .init(title: "Create new text document"),
                    onCompletion: { dismiss() }
                )
            }
        )
        WelcomeActionView(
            iconName: "triangle.fill",
            title: "Open Text Document or Folder",
            action: {
                NSDocumentController.shared.openDocumentWithDialog(
                    configuration: .init(canChooseDirectories: true),
                    onDialogPresented: { dismiss() },
                    onCancel: { openWindow(id: "welcome") }
                )
            }
        )
    },
    onDrop: { url, dismiss in
        print("File dropped at: \(url.path)")
        
        Task {
            NSDocumentController.shared.openDocument(at: url, onCompletion: { dismiss() })
        }
    }
)

License

Licensed under the MIT license

About

A welcome window for NSDocument based applications.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages