目录
目录README.md

DocumentKit Logo

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

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:

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

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.:

@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.

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.

关于
2.1 MB
邀请码
    Gitlink(确实开源)
  • 加入我们
  • 官网邮箱:gitlink@ccf.org.cn
  • QQ群
  • QQ群
  • 公众号
  • 公众号

©Copyright 2023 CCF 开源发展委员会
Powered by Trustie& IntelliDE 京ICP备13000930号