Swiftpack.co - nashysolutions/Directory as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by nashysolutions.
nashysolutions/Directory 5.0.0
A means of accessing the file system conveniently in a SwiftUI environment.
⭐️ 0
🕓 3 weeks ago
iOS macOS
.package(url: "https://github.com/nashysolutions/Directory.git", from: "5.0.0")


iOS macOS

A means of accessing the file system in a SwiftUI environment, conveniently.


Let's assume you have a data type called 'Project'.

struct Project: Codable, Equatable, Container {

    let name: String
    // See wiki/typical-implementation

By conforming to the above protocols, you may now create Directory<Project> or PhotosDirectory<Project>.

struct ContentView: View {
    @StateObject var store: Directory<Project>
    var body: some View {
        List {
            ForEach(store.fetchedItems) { project in
                // do something
        .onAppear(perform: {
            // store.fetchAndWait()
            Task {
               await store.fetch()
    // stores permanently to disk
    // triggers UI re-render
    private func addProject() {
        let project = Project(name: "Project " + UUID().uuidString)
        try! store.append(project)
        // See wiki/useful-api for additional functionality.
  • For parent-child folder relationships see wiki.
  • Demo App available here.
  • Only suitable for small payloads. If using larger files and / or CloudKit consider using NSFilCoordinator directly.


Use the Swift Package Manager documentation.


Stars: 0
Last commit: 3 weeks ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.


Release Notes

Release 5.0.0
3 weeks ago

See Changelog.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics