danielsaidi / DocumentKit

DocumentKit is a Swift SDK that adds more capabilities to DocumentGroup-based apps in SwiftUI.
MIT License
62 stars 3 forks source link
documentgroup ios swift swiftui visionos

DocumentKit Logo

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

About DocumentKit

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

DocumentGroup-based apps are in quite limited when it comes to customization. DocumentKit makes it easier to add custom items to the document browser, present splash and onboarding screens at startup, etc.

This lets you create a better user experience for your DocumentGroup-based apps.

‼️ Important Information

iOS 18 changed how DocumentGroup looks and behaves, by completely changing the underlying types. You can now do a lot more things than before, which makes this SDK less useful.

While this version fixes a few things, and for instance makes the modal screens work, the UIDocumentBrowserViewController customizations no longer work, since the DocumentGroup uses a new underlying type.

Since you can now do more with the native DocumentGroup, this verison will remain as is until iOS 19 is released, then removed...unless anyone comes up with another way to use it in iOS 18.

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.

See the online getting started guide for more information.

Documentation

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

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.