DocumentKit

0.3.0

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

What's New

2023-12-06T13:18:37Z

This version bumps Swift to 5.9.

DocumentKit Logo

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

About DocumentKit

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.

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.

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: [...]
        )
        .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.

Documentation

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

Demo Application

The demo app lets you explore the library on iOS and macOS. 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.

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: Mon Mar 18 2024 20:52:15 GMT-0900 (Hawaii-Aleutian Daylight Time)