DeckKit 0.7.0

DeckKit 0.7.0

Maintained by Daniel Saidi.



DeckKit 0.7.0

DeckKit Logo

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

About DeckKit

DeckKit helps you create deck-based apps in SwiftUI. The result can look like this or completely different:

DeckKit decks can be customized to great extent. You can change colors, fonts, corner radius etc. of the standard card views, and also use completely custom views.

DeckKit supports iOS 13, macOS 11, tvOS 13 and watchOS 6.

Installation

DeckKit can be installed with the Swift Package Manager:

https://github.com/danielsaidi/DeckKit.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 that will help you get started with the library.

In DeckKit, a Deck can be used to define a deck of items that implement the DeckItem protocol.

For instance, consider a Hobby type that looks like this:

struct Hobby: DeckItem {
    
    var name: String
    var text: String

    var id: String { name }
}

You can now create a deck with hobbies and display it in a DeckView:

struct MyView: View {

    @State
    var deck = Deck(
        name: "Hobbies",
        items: [
            Hobby(name: "Music", text: "I love music!"), 
            Hobby(name: "Movies", text: "I also love movies!"), 
            Hobby(name: "Programming", text: "Not to mention programming!")
        ]
    )

    var body: some View {
        DeckView(deck: $deck) {
            // Create a view for the hobby here
        }.padding()
    }
}

The DeckView takes an optional DeckViewConfiguration parameter that can be used to configure the view in various ways. You can for instance use it to control the visual direction, the number of visible items, etc.

You can also provide additional actions that should be triggered when a card is dragged to the leading, trailing, top and bottom edges.

For more information, please see the online documentation and getting started guide.

Documentation

The online documentation has articles, code examples etc. that let you overview the various parts of the library.

Demo Application

This project has a demo app that lets you explore the library on iOS and macOS. To try it out, just open and run Demo/Demo.xcodeproj.

Support this library

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

DeckKit is available under the MIT license. See the LICENSE file for more info.