/DeckKit

DeckKit is a tiny library that helps you create card-based apps in SwiftUI.

Primary LanguageSwiftMIT LicenseMIT

DeckKit


Version Platform Swift 5.3 MIT License Twitter: @danielsaidi

About DeckKit

DeckKit is a tiny SwiftUI library that can help you create deck-based apps.

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

Installation

Swift Package Manager

https://github.com/danielsaidi/DeckKit.git

CocoaPods

pod DeckKit

How does it work

I will add better documentation if anyone starts using this library, but basically it works like this:

  • CardItem is a protocol that inherits Identifiable and Equatable
  • A Deck can be created with any CardItem collection.

Decks can be used as plain data objects, but can also bre presented with SwiftUI.

Presenting a deck

A Deck can be presented in many ways, including these two built in views:

  • StackedDeck stacks cards on top of eachother and lets the user swipe cards off the top.
  • HorizontalDeck presents cards in a horizontal list.

You can easily build your own Deck-based views as well, using plain SwiftUI.

Demo app

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.

Acknowledgements

This library wouldn't have been made without this amazing card tutorial.

Contact me

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 LICENSE file for more info.