FileBrowserSUI

5.0.2

rlegault33/FileBrowserSUI

What's New

Drop down menu

2021-03-28T16:18:00Z

Update the readme with correct instructions

FileBrowserSUI

FileBrowserSUI - iOS File Finder Swift Package in SwiftUI

The failing tag is incorrect, until SPM Testing is able to access Resource files the CI tests will continue to fail.
Swift

GitHub release (latest SemVer)

GitHub

swift-version swiftui-version xcode-version

File Browser SUI

iOS File Browser supporting Swift Packages. Use the default View or create your own and pass it on init to handle file selection. You can specify the starting path and include or exclude file types.

🎏 Features
📱 Browse and select files and folders with a familiar UI on iOS.
👓 Quickview most file types.
📝 Edit/delete files.
⚙️ Fully customizable.
☑️ Each file has the option to allow the develop to specify text descriptors that the user can select from, from a drop down menu
🔍 Thumbnail image for MP4 files

Usage

XCODE Select Project
File->Swift Package->Add Package Dependancy
Copy the following link into Choose Package Repository Search Field
http://github.com/rlegault33/FileBrowserSUI

Specify a file view

You can create your own File handler view that you pass into the FileBrowserSUI on creation. When the user selects a file it will use the view you specify. The view must have a URL variable that will contain the URL of the selected file.

struct AppFileSelectedView: View {
    let url: URL
    var body: some View {
        Text("Show File \(url.lastPathComponent)")
    }
}

Pass View to the package on init by adding a closure to the init call.

NavigationView {
    FileBrowserSUI(initialPath: initPath) { value in
        AppFileSelectedView(url:value)
    }
}

If you do not supply a view enclosure then you must instantiate the FileBrowserSUI with FileBroswerSUIPreview like so.

Usage Example:

NavigationView {
    FileBrowserSUIPreview(initialPath: initPath,
                       xInfo0: FileExtraInfo(get: fileMapInfo.get0, list: fileMapInfo.list0, set: fileMapInfo.set0, delete: fileMapInfo.delete),
                       xInfo1: FileExtraInfo(get: fileMapInfo.get1, list: fileMapInfo.list1, set: fileMapInfo.set1, delete: fileMapInfo.delete))
}

IMPORTANT

You must make sure that FileBrowserSUI* is inside a NavigationView for the NavigationLinks to work.

FUTURE:

If no closure is provided it will use the iOS Quickview functionality. (Still trying to figure this out.)

Descriptor text

For each check mark you must provide a instance of FileExtraInfo that you supply

  • get(URL) -> Int // Index into list array that is currently selected, if value is out of range then it will default to 0
  • list(URL) -> [String]
  • set(URL, Int) -> Void
  • delete(URL) -> Void

It is the developer responsiblity to store the information by its URL as required by your app and supply it via the get() and update it via the set() and delete it from your storage.

See the xcode project Example_FileBrowser_SUI in the FileBrowserSUI package for the full example code.

FileBrowserSUI - screen shot

Description

  • Swift Tools 5.3.0
View More Packages from this Author

Dependencies

Last updated: Wed Dec 27 2023 04:34:55 GMT-1000 (Hawaii-Aleutian Standard Time)