Skip to content

danielsaidi/DeckKit

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
September 25, 2020 11:18
December 5, 2023 11:03
December 5, 2023 11:07
December 5, 2023 10:17
November 29, 2022 10:17
September 19, 2020 10:24
December 5, 2023 10:10
December 5, 2023 10:06
December 5, 2023 10:18
December 5, 2023 11:09

DeckKit Logo

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

About DeckKit

DeckKit helps you create deck-based apps in SwiftUI. It has a DeckView that can render DeckItem collections, with support for swipe gestures, edge swipe detection, shuffling, etc.

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.

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

With DeckKit, you can use a Deck with a set of items that implement the DeckItem protocol:

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

    var id: String { name }
}

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 that can be used to configure 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 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

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