From edbbc8fc619deeb902d62d37f5e4241cca8aee14 Mon Sep 17 00:00:00 2001 From: Peter Larson Date: Sun, 30 May 2021 19:06:27 -0500 Subject: [PATCH] Update README.md --- README.md | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 50 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 3f1c282..22b9b42 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,25 @@ -# SwiftUICardStack +# ๐Ÿ—‚ SwiftUICardStack -A nifty way to organize & navigate a collection of views. + + + + +Create an *easy to peek* SwiftUI View to showcase your own data, catalog, images, or anything you'd like. + +## Contents + +- [๐Ÿ”ญ Supported Platforms](#supported-platforms) +- [๐Ÿ“ฆ Package](#package) +- [๐Ÿ”จ Example](#usage) +- [๐Ÿงจ Extra](#extra) + +## Supported Platforms + +You can use the `CardStack` SwiftUI view in the following platforms: + +- macOS 10.12+ ๐Ÿ–ฅ +- iOS 14.0+ ๐Ÿ“ฑ +- tvOS 14.0+ ๐Ÿ“บ ## Package @@ -19,7 +38,7 @@ Add a dependency in your `Package.swift` .package(url: "https://github.com/p-larson/SwiftUICardStack", branch: "main") ``` -## Basic Usage +## Usage ### Simple example @@ -34,7 +53,13 @@ CardStack(items: data) { item in ``` -### More Advanced Example + +### A More Advanced Example + +See Full Example Usage @ [SwiftUICardStack/Example](/Example/SwiftUICardStack-Example) + +
+ Show psuedo code ```swift import SwiftUICardStack @@ -79,4 +104,24 @@ CardStack( ``` -### See Full Example Usage @ [SwiftUICardStack/Example](/Example/SwiftUICardStack-Example) +
+ +## Extra + +### My Favorite Line of Code from the Package ๐Ÿ’• + +Line 17 of [Sources/SwiftUICardStack/CardStackSource.swift](/Sources/SwiftUICardStack/CardStackSource.swift) + +```swift +private(set) lazy var views: Array = 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](/Sources/SwiftUICardStack/Common.swift) + +### License + +Open Source ๐Ÿ˜Ž