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:
- Website: danielsaidi.com
- Mastodon: @danielsaidi@mastodon.social
- Twitter: @danielsaidi
- E-mail: daniel.saidi@gmail.com
License
DeckKit is available under the MIT license. See the LICENSE file for more info.

