Update README.md
AnimatedSwipeCard is a custom swipe card with animation and can be used with confirmationDialog or alert.
confirmationDialog
alert
https://user-images.githubusercontent.com/2520545/160837700-916c3355-17c0-4ee8-a86e-b9cd033e4863.mp4
AnimatedSwipeCard is available through Swift Package Manager.
Using AnimatedSwipeCard is easy
AnimatedSwipeCard
struct ContentView: View { @State var showCardAlert = false @State var selectedText = "" @State var bindingID = "" @State var bindingText = "" @State var bindingSubText = "" var body: some View { VStack { List { ForEach(RowItems, id:\.self){ item in //add binding for a string for ID that can be passed CardRowView(animationShakeAmount: 5.0, titleText: item.text, subText: item.subText, cardID: String(bindingID), color: "StatusCard", imageName: "rocket_green", showCardAlert: $showCardAlert, bindingID: $bindingID, bindingText: $bindingText, bindingSubText: $bindingSubText) .frame(height: 150) .padding(.vertical) .listRowBackground(Color.clear) } } .alert(isPresented: $showCardAlert) { Alert( title: Text("Greatest Band Is: \(bindingText)"), message: Text(bindingSubText) ) } } .listStyle(.plain) } }
animationShakeAmount
optional
swipeScale
Double
titleText
String
subText
cardID
color
imageName
imageHeight
CGFloat
showCardAlert
Bool
Binding parameters can be used with an alert or confirmationDialog
bindingID
bindingText
bindingSubText
.alert(isPresented:$showCardAlert) { Alert( title: Text("Are you sure you want to delete \(bindingText)?"), message: Text("There is no undo"), primaryButton: .destructive(Text("Delete")) { deleteitem(bindingID) }, secondaryButton: .cancel() ) }
Credit to https://lukaszadam.com/ for rocket image
Rob Evans, robert.evansii@gmail.com
CloudKitStatus is available under the MIT license. See the LICENSE file for more info.
©Copyright 2023 CCF 开源发展委员会 Powered by Trustie& IntelliDE 京ICP备13000930号
AnimatedSwipeCard
AnimatedSwipeCard is a custom swipe card with animation and can be used with
confirmationDialog
oralert
.https://user-images.githubusercontent.com/2520545/160837700-916c3355-17c0-4ee8-a86e-b9cd033e4863.mp4
Installation
AnimatedSwipeCard is available through Swift Package Manager.
Usage
Using
AnimatedSwipeCard
is easyParameters
animationShakeAmount
-optional
: higher the number the more of an angle of the card. Defaults at 5.0swipeScale
-optional
:Double
Scales the card to 0.8 as the defaulttitleText
:String
Main textsubText
:String
subtextcardID
-optional
:String
passed IDcolor
-optional
:String
asset color as a stringimageName
-optional
:String
image name as a string to be used in cardimageHeight
-optional
:CGFloat
image height. Defaults to 50imageHeight
-optional
:CGFloat
image width. Defaults to 50showCardAlert
:Bool
State to show alertBinding parameters can be used with an
alert
orconfirmationDialog
bindingID
:String
pass State to store ID.bindingText
:String
pass State to store text. This maybe the same as titleTextbindingSubText
:String
pass State to store text. This maybe the same as subTextExample
Credits
Credit to https://lukaszadam.com/ for rocket image
Author
Rob Evans, robert.evansii@gmail.com
License
CloudKitStatus is available under the MIT license. See the LICENSE file for more info.