aheze / swipeactions Goto Github PK
View Code? Open in Web Editor NEWAdd customizable swipe actions to any view.
Home Page: https://twitter.com/aheze0/status/1646399867764510721
License: MIT License
Add customizable swipe actions to any view.
Home Page: https://twitter.com/aheze0/status/1646399867764510721
License: MIT License
Whenever I try to scroll up or down in the example app, it only works if I use the left or right edge of the screen. Does it work inside scroll views?
the swipeActions buttons are appearing in the correct side which is the left side for Arabic Language, But i can't swipe from left to right.
I've been using this as a workaround for a bug with SwiftUI lists in lists.
In my example, I've hit an issue where I have four swipe action buttons, two leading and two trailing with a 90 or 100 width. The style is set to .mask
.
In this situation the 3rd swipe button (the first on the right and the leftmost right/trailing button) is only tappable on its right side and not on its left side.
If the style is changed to .cascade
or .equalWidths
the 3rd button becomes fully tappable instead of half-tappable.
If you have any quick answers feel free to reply.
Many apps with swipe actions display a "hint" to let the user know that swipe actions are available.
SwipeActions should have an option for programmatically setting a custom offset (~20px or so).
Trying to make a SwipeView and SwipeAction that both have a corner radius less than about 18 makes the SwipeView have a smaller corner radius than the Swipe Action. I want a corner radius of 12, but I am not able to because the swipeActionCornerRadius() modifier doesn't do anything below values of around 18.
var body: some View {
SwipeView {
Text("Hello")
.frame(maxWidth: .infinity)
.padding(.vertical, 20)
.background(Color.blue.opacity(0.1))
.cornerRadius(12)
} trailingActions: { _ in
SwipeAction("World") {
print("Tapped!")
}
}
.swipeActionCornerRadius(12)
}
With this linked zip on the README: https://github.com/aheze/SwipeActions/archive/refs/heads/main.zip
Upon opening in Xcode, I get:
unable to override package 'SwipeActions' because its identity 'swipeactions' doesn't match override's identity (directory name) 'swipeactions-main'
multiple products named 'SwipeActions' in: 'swipeactions', 'swipeactions-main'
Obviously it's very fixable, just thought you might want to know.
VoiceOver support needs to be added.
Yes, IK swipe actions maybe not the perfect thing for vision pro, but I have an ios app using this library which I would love to try out (including swiping) and it fails to build because their is no Haptic feedback
Is there a way to make it so that if there are multiple actions on a view, if the user swipes a certain threshold it shows action1, if they keep swiping it switches to action2?
And if so, can they support swipe to perform action? As in, if they swipe a certain amount while action1 is showing and release it fires the event
example: https://wefwef.app/posts/lemmy.world/all
if you swipe on a post it shows 1 action, continue swiping it shows action 2? (this example appears to be heavily inspired by Apollo)
I need something like this to adjust SwipeView
SwipeView {
teamNoteRow(note: note)
.contentShape(Rectangle())
} trailingActions: { context in
SwipeAction(action: {
withAnimation {
viewModel.deleteNote(id: note.id)
}
}, label: { _ in
Image(systemName: "trash")
.foregroundColor(Color.white)
}, background: { _ in
Color.red
})
.onReceive(context) { newValue in
isTrailingActionVisible = context == .open // globaly detect state of swipe actions
}
When the control wrapped inside the SwipeView
contains a .contextMenu
modifier, swiping it will semi-occasionally momentarily result in a non-smooth duplication of the wrapped view:
When I removed the contextMenu, it worked perfectly fine. I believe it is as simple as that, but if you need more information, please let me know.
VStack {
SwipeViewGroup{
ForEach(outRecord, id:\.self){ out in
SwipeView {
OutCardView(out)
.onTapGesture {
outVM.loadSingle(out: out)
mainStack.append(.outSummary)
}
.frame(maxWidth: .infinity)
.contentShape(Rectangle())
} leadingActions: { _ in
SwipeAction("delete", systemImage: "trash.circle", backgroundColor: .red) {
}.allowSwipeToTrigger()
.foregroundColor(.white)
} trailingActions: { _ in
SwipeAction("copy", systemImage: "doc.circle", backgroundColor: .yellow) {
}.allowSwipeToTrigger()
.foregroundColor(.white)
}
.swipeActionCornerRadius(1)
Divider()
.padding()
}
}
}
when i swipe left and right, there is an error kept shown up:
Invalid sample AnimatablePair<AnimatablePair<CGFloat, CGFloat>, AnimatablePair<CGFloat, CGFloat>>(first: SwiftUI.AnimatablePair<CoreGraphics.CGFloat, CoreGraphics.CGFloat>(first: 18.0, second: 0.0), second: SwiftUI.AnimatablePair<CoreGraphics.CGFloat, CoreGraphics.CGFloat>(first: 0.0, second: 0.0)) with time Time(seconds: 0.0) > last time Time(seconds: 0.016702291672118008)
I'm implementing infinite pagination scrolling, where I have to fetch new data and draws the new cells in a ScrollView (in a LazyVStack). For some reason, the allowSwipetoTrigger modifier doesn't apply to new cells being added to the list.
Anyone has any insight why that might be the case? Thanks!
Documentation says it's possible to override id
by set options.id
, however i couldn't find any thing related.
Access the SwipeView id
is important for context where we're trying to open multiple rows programmatically. SwipeViewGroup doesn't seem to be affected by context state changes like context.state.wrappedValue = context.state.wrappedValue == .expanded ? .closed : .expanded
, so access id would allow us to set correctly the swipeViewGroupSelection
and eventually automatically close not target rows.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.