Swiftpack.co -  p-larson/SwiftUICardStack as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
p-larson/SwiftUICardStack
Create an easy to peek SwiftUI View to showcase your own data, catalog, images, or anything you'd like.
.package(url: "https://github.com/p-larson/SwiftUICardStack.git", from: "v1.0")

πŸ—‚ SwiftUICardStack

Create an easy to peek SwiftUI View to showcase your own data, catalog, images, or anything you'd like.

Contents

Supported Platforms

You can use the CardStack SwiftUI view in the following platforms:

  • macOS 10.12+ πŸ–₯
  • iOS 14.0+ πŸ“±
  • tvOS 14.0+ πŸ“Ί

Package

For your XCode Package

File > Swift Packages > Add Package Dependency: https://github.com/p-larson/SwiftUICardStack

Select main branch then click done.

For Swift Packages

Add a dependency in your Package.swift

.package(url: "https://github.com/p-larson/SwiftUICardStack", branch: "main")

Usage

Simple example

CardStack(
    items: cards,
    selection: $selectedCard,
    builder: CardView.init(model:)
)
.sheet(item: $selectedCard) { card in
    VStack {
        Text(card.name)
        Text(card.description)
        Text(card.id)
        Text(card.someMoreDetailedInformation())
    }
}

See Full Example Usage @ SwiftUICardStack/Example

Extra

My Favorite Line of Code from the Package πŸ’•

Line 17 of Sources/SwiftUICardStack/CardStackSource.swift

private(set) lazy var views: Array<AnyView> = items.map(builder).map(\.eraseToAnyView)

Why this is my favorite

I use the power of KeyPaths to type erase the data set in a short and sweet one liner!

See View#eraseToAnyView

License

Open Source MIT License, aka: use how you please 😎

GitHub

link
Stars: 6
Last commit: 1 week ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Release Notes

Initial Release (1.0.0)
2 weeks ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API