DocumentKit adds more capabilities to DocumentGroup
-based iOS apps.
DocumentGroup
-based apps are limited when it comes to customization. For instance, you can't add any custom items to the document browser toolbar, and since it has no view until you open a document, you can't present any 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 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 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: [...]
)
.showFileExtensions(true)
.onboardingSheet {
MyModalView()
}
}
}
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!")
}
}
Additionally, DocumentKit extends DocumentGroup
with a modifier that lets you present a splash screen each time the app runs - both with a configurable option to stop presenting it and options to configure when it is presented (delay) and when it is automatically dissmissed (dismiss):
@main
struct DemoApp: App {
var body: some Scene {
DocumentGroup(newDocument: DemoDocument()) { file in
ContentView(document: file.$document)
}
.splashScreenSheet(delay: 0.5, dismiss: 3) {
MySplashScreen()
}
}
}
struct MySplashScreen: DocumentGroupModal {
var body: some View {
Text("Hello, Splishy Splash screen!")
}
}
DocumentKit also lets the DocumentGroup
present any DocumentGroupModal
as a sheet, a full screen cover, or using any UIKit-specific modal presentation type.
For more information, please see the getting started guide.
The online documentation has more information, articles, code examples, etc.
The demo app lets you explore the library on iOS and macOS. To try it out, just open and run the Demo
project.
You can sponsor me on GitHub Sponsors or reach out for paid support, to help support my open-source projects.
Feel free to reach out if you have questions or if you want to contribute in any way:
- Website: danielsaidi.com
- Mastodon: @danielsaidi@mastodon.social
- Twitter: @danielsaidi
- E-mail: daniel.saidi@gmail.com
DocumentKit is available under the MIT license. See the LICENSE file for more info.