DocumentKit adds more capabilities to DocumentGroup-based iOS apps.
Unlike regular SwiftUI apps, document-based apps have a DocumentGroup root scene, into which you can load a custom document view. It’s a powerful way for apps to edit documents and store them on device and in the cloud.
However, document apps are currently very limited when it comes to customizations. For instance, you can’t add custom toolbar items to the document browser, and since a DocumentGroup doesn’t have a view until you open a document, you can’t present initial onboarding screens or modals from it.
DocumentKit lets you do all these things, to let you create a better app experience for your document-based apps.
DocumentKit supports iOS 14 and later.
Installation
DocumentKit can be installed with the Swift Package Manager:
https://github.com/danielsaidi/DocumentKit.git
If you prefer to not have external dependencies, you can also just copy the source code into your app.
DocumentKit extends DocumentGroup with more view modifiers, to 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: [...]
)
.showFileExtensions(true)
}
}
DocumentKit also extends DocumentGroup with a modifier that lets you present an onboarding screen when the app starts for the first time:
@main
struct DemoApp: App {
var body: some Scene {
DocumentGroup(newDocument: DemoDocument()) { file in
ContentView(document: file.$document)
}
.onboardingSheet {
MyOnboardingScreen()
}
}
}
struct MyOnboardingScreen: DocumentGroupModal {
var body: some View {
Text("Hello, onboarding!")
}
}
DeckKit also lets the DocumentGroup present any DocumentGroupModal as a sheet, a full screen cover, or using any UIKit-specific modal presentation type.
About DocumentKit
DocumentKit adds more capabilities to
DocumentGroup
-based iOS apps.Unlike regular SwiftUI apps, document-based apps have a
DocumentGroup
root scene, into which you can load a custom document view. It’s a powerful way for apps to edit documents and store them on device and in the cloud.However, document apps are currently very limited when it comes to customizations. For instance, you can’t add custom toolbar items to the document browser, and since a
DocumentGroup
doesn’t have a view until you open a document, you can’t present initial onboarding screens or modals from it.DocumentKit lets you do all these things, to let you create a better app experience for your document-based apps.
DocumentKit supports
iOS 14
and later.Installation
DocumentKit can be installed with the Swift Package Manager:
If you prefer to not have external dependencies, you can also just copy the source code into your app.
Getting started
The online documentation has a getting started guide to help you get started with DocumentKit.
DocumentKit extends
DocumentGroup
with more view modifiers, to let you add custom toolbar items, customize the document browser etc.:DocumentKit also extends
DocumentGroup
with a modifier that lets you present an onboarding screen when the app starts for the first time:DeckKit also lets the
DocumentGroup
present anyDocumentGroupModal
as a sheet, a full screen cover, or using any UIKit-specific modal presentation type.For more information, please see the online documentation and getting started guide guide.
Documentation
The online documentation contains more information, code examples, etc., and makes it easy to overview the various parts of the library.
Demo Application
The demo app lets you explore the library. To try it out, just open and run the
Demo
project.Support this library
I manage my various open-source projects in my free time and am really thankful for any help I can get from the community.
You can sponsor this project on GitHub Sponsors or get in touch for paid support.
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.