Contents

ctreffs/SwiftNFD

Swift wrapper for Native File Dialog, a tiny, neat C library that portably invokes native file open and save dialogs.

Usage ##

Single file dialog

// open single file dialog without filters
let result = NFD.OpenDialog()
    
switch result {
case let .success(path):
    if let path = path {
        // use path
    } else {
        // user canceled
    }
case let .failure(error):
    // an error has occured
}

macOS Demo

You can find a macOS demo application in /Apps/NFD-Demo/NFD-Demo.xcodeproj

[NFD-Demo]

File Filter Syntax

There is a form of file filtering in every file dialog API, but no consistent means of supporting it. NFD provides support for filtering files by groups of extensions, providing its own descriptions (where applicable) for the extensions.

A wildcard filter is always added to every dialog.

Examples ####

txt The default filter is for text files. There is a wildcard option in a dropdown.

png,jpg;psd The default filter is for png and jpg files. A second filter is available for psd files. There is a wildcard option in a dropdown.

nil Wildcard only.

Copyright and Credit

Copyright © 2014-2019 Frogtoss Games, Inc. File LICENSE covers all files in this repo.

Native File Dialog by Michael Labbe <mike@frogtoss.com>

Tomasz Konojacki for microutf8

Denis Kolodin for mingw support.

Tom Mason for Zenity support.

Support ##

Directed support for this work is available from the original author under a paid agreement.

Contact Frogtoss Games.

Package Metadata

Repository: ctreffs/SwiftNFD

Stars: 3

Forks: 0

Open issues: 9

Default branch: main

Primary language: c

License: Zlib

Topics: dialog, linux, macos, spm, swift, swift-package-manager, windows

README: README.md