eonist / WizardHelper

🧙‍♂️Crossplatform-save-file-wizard for iOS and macOS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tests codebeat badge

WizardHelper

Open / save prompts for macOS and iOS

WizardHelper is a Swift library that provides open and save prompts for macOS and iOS. It uses NSOpenPanel and NSSavePanel on macOS, and UIDocumentPickerViewController on iOS.

Index

Installation

You can install WizardHelper using Swift Package Manager. Add the following line to your Package.swift file:

.package(url: "https://github.com/sentryco/WizardHelper.git", from: "1.0.0")


### Examples:
```swift
// macOS: Prompt the user to save a file
WizardHelper.promptSaveFile(fromURL: url, fileName: fileInfo.fileName, view: self)

// macOS: Prompt the user to open a file
WizardHelper.promptOpenFile(view: self)

// iOS: Prompt the user to open a file
WizardHelper.promptOpenFile(from: self) { result in
    switch result {
    case .success(let urls):
        // Do something with the selected URLs
    case .failure(let error):
        // Handle the error
    }
}

Gotcha iOS

  • You might need to set Supports opening documents in place, Application supports iTunes file sharing, and Supports Document Browser to YES in your app's Info.plist file.
  • You might need to set app-sandbox - user selected files - read / write to true.
  • See this link for more Info.plist gotchas.

Todo:

  • Add github action
  • Add tests (UITests) 👈

License

WizardHelper is available under the MIT license. See the LICENSE file for more info.

About

🧙‍♂️Crossplatform-save-file-wizard for iOS and macOS

License:MIT License


Languages

Language:Swift 100.0%