Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
DeckKit is a tiny SwiftUI library that can help you create deck-based apps.
DeckKit, you can present any model that implements
CardItem as cards. It can look like this:
I will add a stunning (well...) logo and improve the documentation after the library gets 50 stars or the first external issue. Until then, create issues or reach out to me if you need help.
Swift Package Manager
How does it work
I will add better documentation if anyone starts using this library, but basically it works like this:
CardItemis a protocol that inherits
Deckcan be created with any
Decks can be used as plain data objects, but can also bre presented with SwiftUI.
Presenting a deck
Deck can be presented in many ways, including these two built in views:
StackedDeckstacks cards on top of eachother and lets the user swipe cards off the top.
HorizontalDeckpresents cards in a horizontal list.
You can easily build your own
Deck-based views as well, using plain SwiftUI.
This repo contains a very basic, universal demo app that runs on iOS 14 and macOS 11.
Just open the
Demo project and run the app on either platform.
The library could run on tvOS as well, but the demo currently has no tvOS app.
This library wouldn't have been made without this amazing card tutorial.
Feel free to reach out if you have questions or if you want to contribute in any way:
DeckKit is available under the MIT license. See LICENSE file for more info.
|Last commit: 8 weeks ago|
You may find interesting
deck init params for
HorizontalDeck has been changed to a binding.
This gives you better control over the deck, removes UI glitches and helped me remove a bunch of state for visible cards in
StackDeck, which means that deck modifications now instantly trigger UI changes.
I have added a shuffle button to the demo to demonstrate how much better the stacked deck performs.
StackedDeck has been improved in more ways:
- I have changed the order of how the vertical offset and scale effect are applied, which fixes a UI glitch.
- I have added
swipeLeft/Right/Up/Downactions, which let you trigger actions depending on how a card is swiped off the top.
DeckContext class is still in the library, but is not used by the library itself.