GithubHelp home page GithubHelp logo

aheze / swipeactions Goto Github PK

View Code? Open in Web Editor NEW
909.0 5.0 37.0 8.74 MB

Add customizable swipe actions to any view.

Home Page: https://twitter.com/aheze0/status/1646399867764510721

License: MIT License

Swift 100.00%
gesture ios notifications swift swiftui swipe swipe-actions drag list

swipeactions's People

Contributors

aheze avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

swipeactions's Issues

Scroll doesn't work in the example app

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?

Issue on tapping 3rd of 4 buttons in .mask ActionStyle

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.

"Hint" style (option to set custom swipe offset)

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

SwipeAction has some unknown minimum corner radius

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)
    }

Screenshot 2023-06-06 at 5 03 12 PM

Accessibility Support

VoiceOver support needs to be added.

  • [] Read out swipe actions (currently they're completely ignored)
  • [] Option to group main label content as a single accessibility element

Check if UIImpactGenerator is allowed

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

Multiple actions collapsing on long swipe?

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)

Detect Swipe Action Context State

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
}

Bug when swipe left and right

                    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)

Can't access SwipeView id

Documentation says it's possible to override id by set options.id, however i couldn't find any thing related.

Screenshot 2024-02-01 at 12 26 48

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.