DocumentKit

0.4.0

DocumentKit is a Swift SDK that adds more capabilities to DocumentGroup-based apps in SwiftUI.
danielsaidi/DocumentKit

What's New

2024-05-26T21:43:30Z

This version adds support for visionOS and Swift strict concurrency.

This version also cleans up the ways a modal can be presented, by adding a new enum that can be used instead of having separate functions.

✨ Features

  • DocumentGroup.splashScreen now supports conditional presentations.
  • DocumentGroupModalType is now used to avoid having several presentation functions where only the modal type differs.

💡 Adjustments

  • DocumentGroup.onboardingModal replaces the many earlier variations.
  • DocumentGroup.splashScreen replaces the many earlier variations.
  • DocumentGroupModal now conforms to Sendable to work within modals.

DocumentKit Logo

Version Swift 5.9 Swift UI MIT License Twitter: @danielsaidi Mastodon: @danielsaidi@mastodon.social

About DocumentKit

DocumentKit is an SDK that adds more capabilities to DocumentGroup-based SwiftUI apps.

DocumentGroup-based apps are in general quite limited when it comes to customization. For instance, you can't add custom items to the document browser toolbar.

Also, since a DocumentGroup has no view until you open a document, you can't present any initial onboarding screens or modals from it.

DocumentKit makes it easy to do all these things, to let you create a better user experience for your document-based apps.

Installation

DocumentKit can be installed with the Swift Package Manager:

https://github.com/danielsaidi/DocumentKit.git

Getting started

DocumentKit extends DocumentGroup with modifiers that let you add custom toolbar items, customize the document browser etc.:

@main
struct MyApp: App {

    var body: some Scene {
        DocumentGroup(newDocument: DemoDocument()) { file in
            ContentView(document: file.$document)
        }
        .additionalNavigationBarButtonItems(
            leading: [...],
            trailing: [...]
        )
        .allowsDocumentCreation(true)
        .allowsPickingMultipleItems(true)
        .showFileExtensions(true)
        .onboardingSheet {
            MyOnboardingScreen()
        }
        .splashSheet {
            MySplashScreen()
        }
    }
}

DocumentKit also extends DocumentGroup with modifiers that let you present onboarding modals and splash screens when the app launches, lets you inspect the underlying document browser, etc.

For more information, please see the getting started guide.

Documentation

The online documentation has more information, articles, code examples, etc.

Demo Application

The demo app lets you explore the library with iOS. To try it out, just open and run the Demo project.

Support my work

You can sponsor me on GitHub Sponsors or reach out for paid support, to help support my open-source projects.

Your support makes it possible for me to put more work into these projects and make them the best they can be.

Contact

Feel free to reach out if you have questions or if you want to contribute in any way:

License

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

Description

  • Swift Tools 5.9.0
View More Packages from this Author

Dependencies

  • None
Last updated: Wed Jul 24 2024 23:38:10 GMT-0900 (Hawaii-Aleutian Daylight Time)