Giter Site home page Giter Site logo

swipecellkit / swipecellkit Goto Github PK

View Code? Open in Web Editor NEW
6.2K 72.0 798.0 8.16 MB

Swipeable UITableViewCell/UICollectionViewCell based on the stock Mail.app, implemented in Swift.

Home Page: https://jerkoch.com/2017/02/07/swiper-no-swiping.html

License: Other

Swift 99.10% Objective-C 0.30% Ruby 0.39% Shell 0.21%
swift uikit ios swipe uitableview uitableviewcell drag tableview

swipecellkit's Issues

iOS 11 cell interaction bug

I have an app which uses SwipeCell, it works perfectly fine on iOS 10 and earlier but while testing it simultaneously on iOS 11, the cell are interactiveness, didSelectRowAt and editActionsForRowAt are not getting called, however default cells are working properly and calling didSelectRowAt and editActionsForRowAt.

a note to be made is that calling
cell.showSwipe(orientation: .left, animated: true, completion: nil)
and
cell.hideSwipe(animated: true)

It is unclear to me as of yet if this is a bug within the SwipeCellKit or iOS 11 but I will dig and report any findings... just thought to give you guys a heads up so that you are aware of this.

leak

can you look up it?
2017-05-31 10 36 13

Allow customization of elasticity when swiping

Right now, when using a percentage target on SwipeExpansionStyle, the cell "resists" dragging with an elastic behavior once it reaches the target threshold. It would be great to add a property on SwipeExpansionStyle that controls how much elasticity is applied. I imagine this might range from 0.0 (no elasticity at all, the drag continues to move with your finger) to 1.0 (no dragging at all past the target) with a default value somewhere in between.

(This request originated in our discussion here: #29)

Unwind Segue causes SwipeAction button menu to disappear

@jerkoch I just found a bug where, if using a UINavigationController, if the SwipeAction menu is currently opened when another View Controller is pushed onto the stack, then an unwind segue is performed back to the main View Controller, the SwipeAction menu buttons disappear.

To get the SwipeAction menu to show again, you have to swipe left on that cell.

Here's a screenshot:

Before Unwind Segue:
fullsizerender

After Unwind Segue:
fullsizerender-2

Currently, the only fix I can across is to reload the tableview in whatever function returned from when an Unwind segue occurs so that the SwipeAction menu disappears.

Using SwipeCellKit in UITableView inside UIScrollView

Hi!
I have an UIScrollView, which contains multiple UITableViewController, so could horizontally swipe between them. But when I add SwipeTableViewCell's in tableView and if i would try to swipe left/right i can only access SwipeActions, but not the UIScrollView...
Is it possible to set some kind of area on SwipeTableViewCell (for example, from left corner to centre of the cell) where if i swipe, i would see SwipeActions, and if i swipe outside this area -> then just use simple paging functionality between controllers?
Thanks!

Swipe cell with accessory doesn't call accessoryButtonTapped

Hey,

I have a custom cell (subclass of SwipeTableViewCell). When I add an accessory view using cell.accessoryType = .detailButton, the method tableView(_ tableView: UITableView, accessoryButtonTappedForRowWith indexPath: IndexPath) doesn't get called.

When using a subclass of UITableViewCell, it all works fine, so pretty sure it's a bug.

Do you need a sample project or is it fine like this?

Thanks for the great library!

ActionsView is above cell's contentView

Currently, any actions added to the cell are added above the cell's contentView.
I understand the reason behind this but with the current implementation, you can't achieve an effect like the one below.

screen shot 2017-07-03 at 10 15 47

We could bring the contentView to the front when the configureActionsView on SwipeTableViewCell method is called.

Crash on iOS 10.0

Hey guys,

I tested my app on an iPhone 5s which is running iOS 10.0 and sadly SwipeCellKit crashes the app when I try to swipe my cells.

Tried the sample app and it crashes too. Not sure if you can reproduce it on Simulator since I'm unable to download 10.0 simulator at the moment.. :(

Here the exact line where the sample app crashes:
screen shot 2017-06-09 at 14 54 13

I'm not sure what's the reason of the crash yet (maybe UIImpactFeedbackGenerator is buggy on iOS 10.0??), do you have any idea or quick solution?

Pull down/Release on cell with SwipeAction buttons visible removes background colors?

1.
I have 3 SwipeAction buttons with different background colors.

If all the SwipeAction buttons are visible, and I pull down on the area of the cell not covered by the SwipeAction buttons, i.e. the lighter area on the left, then release my finger, this momentarily causes all the SwipeAction button backgrounds to become clear like so:"

untitled

After half a second, it returns back to the normal assigned background colors.

2.
The SwipeAction buttons doesn't retract back to the right.

Are both this things suppose to occur or is this a bug?

Minimum deployment target

What is the minimum ios version supported? I cloned the repo and was able to build for ios 8. However, when I try to import it into my project (with ios target 8.0), I get the following error:

[!] Unable to satisfy the following requirements:

- `SwipeCellKit` required by `Podfile`

Specs satisfying the `SwipeCellKit` dependency were found, but they required a higher minimum deployment target.

Programmatically trigger the display of swipe actions

Hey,

Im looking for a manual way to trigger showing the editing options. In particular, I would like to show editing options when didSelectRowAtIndex is called. I see there is support for hideSwipe(animated:), but I don't see an option for any showSwipe(animated:). Is it possible? Thanks

Andrew

setSwipeOffset and the delegate

Is there any way of not triggering the willStart/didEnd delegate callbacks when using setSwipeOffset? I need to tell if the user initiated the swipe or it's the programmatic setSwipeOffset(). Any pointers to doing this?

App crash when try to delete

I am getting this issue when try to delete

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of rows in section 0. The number of rows contained in an existing section after the update (2) must be equal to the number of rows contained in that section before the update (2), plus or minus the number of rows inserted or deleted from that section (0 inserted, 1 deleted) and plus or minus the number of rows moved into or out of that section (0 moved in, 0 moved out).

[func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath, for orientation: SwipeActionsOrientation) -> [SwipeAction]? {
guard orientation == .right else { return nil }

    let deleteAction = SwipeAction(style: .destructive, title: "Delete") { action, indexPath in
        // handle action by updating model with deletion
        self.com.showProgress()
        let dict=self.arrayPendings[indexPath.row] as! [String:Any]
        if let reid=dict["RequestId"] as? Int
        {
            self.selectedReqID=String(reid)
        }
        self.deleteLeave(){ (status) in
        
            if(status)
            {
                var options = SwipeTableOptions()
                options.expansionStyle = .destructive(automaticallyDelete: false)
                let delete = SwipeAction(style: .destructive, title: nil) { action, indexPath in
                
                    self.com.removeProgress()
                     self.arrayPendings.remove(at: indexPath.row)
                   self.tblPendingLeaves.beginUpdates()
                    self.tblPendingLeaves.insertRows(at: [IndexPath(row: 0, section: 1)], with: .automatic)
                    
                    action.fulfill(with: .delete)
                    
                    self.tblPendingLeaves.endUpdates()
                }
              
            }
        }
    
    }
    
    // customize the action appearance
    deleteAction.image = UIImage(named: "Delete")
    
    return [deleteAction]
}

]

Please help me.

Calls to UITableView.beginUpdates/endUpdates hide swipe actions

I'm running into an issue where calls to UITableview.beginUpdates and UITableview.endUpdates while action buttons are visible causes the buttons to be hidden, even if the cell in question doesn't change. That's particularly problematic when using an NSFetchedResultsController. Is there a setting that I'm missing that changes this behavior?

Feature request: Bounce cell to reveal actions

Swipe actions are not always easy to discover by users. It would therefore be nice to have SwipeCellKit provide an easy mechanism to bounce a selected cell after x seconds to make the swipe discoverable.

Decoration View

Im trying to figure out if its possible to add a "decoration view" that is not the same size as the buttons. I need a smaller view between the cell content view and when the SwipeActionButtons start.
Is this possible in any way atm?

Image and title not retina sharp

I absolutely love this library. So simple and easy to implement, thank you!
I'm not sure if this is a bug or if I'm doing something wrong. However, it looks like both the title and the image shows up a bit blurry. Almost like using "@1x" images on retina devices.
My icons are 60x60 @2x. At first I thought I had done something wrong with my icons, but then I saw that the title was also not retina sharp.
Anything I should consider to identify the blurriness?

Brgds,
Erik

Missing actions

I have cell with right and left actions.
Left actions have "fill" expansionStyle and Right have "destructive" expansionStyle.
When left action was performed, the right actions are invisible, I can swiping the cell, actions is performing, but actions button are invisible.

Support vibrancy effect

It would be cool to have a vibrant color background for view controllers presented over the current context and using a blur effect as the background. Standard UITableViewRowActions "support" it but currently broken and shows no text.

UI Bug(Tableview with multiple custom cells)

Hi, I think I may have found a bug or I don't know,

here's what happened, I created a tableview with 2 custom cells, one being a subclass of SwipeTableViewCell and the other one, just an empty cell.

Whenever the other non SwipeTableViewCell is not being dequeued, it seems that the hideSwipe is not being called when swiping another cell which leaves the other cell on swipe state even when you swipe another cell.

Workaround I did is subclassing both custom cells as SwipeTableViewCell, which gives me the behavior I want upon doing this.

if there's something I missed as part of cell's configuration to get what I want please let me know.

Please see screenshot below:

screen shot 2017-05-27 at 2 03 39 pm

Ios 8 support

this library is not supporting ios 8 and swift 3 ?

swift 4 compile errors

There're issues with this library when run in Xcode 9 with Swift 4. Some of issues I could fix by myself, but there're issues I can't fix:
etSwipeOffset(.greatestFiniteMagnitude * orientation.scale.negated()

and here:
let maxOffset = min(bounds.width, abs(offset)) * orientation.scale.negated()

Xcode complains:
'negated()' is unavailable: Please use operators instead. 'negated()' was obsoleted in Swift 4

Do you have idea how to fix this issue?

Unresponsive cell

I found a bug.

  1. I have custom cell, whit inherit from SwipeTableViewCell class.
  2. This cell has imageView object.
  3. When I try to swipe cell and my finger lies on this imageView, I have a bug - cell is unresponsive (I can not select, swipe on this cell etc.)

After that I change subclass of this custom cell from SwipeTableViewCell to UITableViewCell and everything is ok, so problem in SwipeTableViewCell class. After that I was found that bug is gone if I commented 128 line in SwipeTableViewCell class:


 if state == .center || state == .animatingToCenter {
                //state = .dragging ----> It is fix bug, but I do not know why

                let velocity = gesture.velocity(in: target)
                let orientation: SwipeActionsOrientation = velocity.x > 0 ? .left : .right

                showActionsView(for: orientation)
}

App crash

Hello! I implemented the UITableViewDelegate method in the MailExample app and got an app crash. How can I fix it? Thanks.

Update: Also I want to add, when we click on the indicator that the message is not read, then the call of the cell click is triggered.

override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
     super.tableView(tableView, didSelectRowAt: indexPath)
     debugPrint("didSelectRowAt", indexPath.row)
 }

2017-05-09 17:42:20.582211+0400 MailExample[3407:768893] -[MailExample.MailViewController tableView:didSelectRowAtIndexPath:]: unrecognized selector sent to instance 0x100d08ce0
2017-05-09 17:42:20.583263+0400 MailExample[3407:768893] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MailExample.MailViewController tableView:didSelectRowAtIndexPath:]: unrecognized selector sent to instance 0x100d08ce0'
*** First throw call stack:

Allow control on actions container view please

My row view has a bottom margin and there's a discrepancy between the actions and the row.
I'll attach 2 screenshots: my custom implementation with a scrollview inside the row, and how it looks with SwipeCellKit.

screenshot 2017-02-27 11 16 44
screenshot 2017-02-27 11 18 12

Tableview dont trigger touch event

First i want to say, that this Extension is awesome!! Im a beginner and love to work with it!! :-)

But i think i found a bug. If i run the example Mail App and swipe fast to delete a entry (Destructive) right after the entry disappeared i want to scroll the tableview but it doesn't trigger. Only if i tab on a Entry and go back everythink works fine again.

Can someone confirm it?
Include SwipeCellKit to my Project and get the same problem.

Swipe Delete Animation Appearing on wrong TableViewCell

I am currently implementing a Swipe to delete feature to my tableview. In some cases, the delete animation will finish on the incorrect line, resulting in a strange animation. My implementation is pretty bare:

func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath, for orientation: SwipeActionsOrientation) -> [SwipeAction]? {
        if orientation == .right {
            let deleteAction = SwipeAction(style: .destructive, title: nil) { (action, indexPath) in
                self.currentDishes.remove(at: indexPath.row)
            }
            deleteAction.backgroundColor = CDColor.red
            deleteAction.image           = #imageLiteral(resourceName: "trash_small")
            return [deleteAction]
        } else {
            return nil
        }
    }
    
func tableView(_ tableView: UITableView, editActionsOptionsForRowAt indexPath: IndexPath, for orientation: SwipeActionsOrientation) -> SwipeTableOptions {
        var options = SwipeTableOptions()
        options.expansionStyle  = orientation == .left ? .destructive : .destructive
        options.transitionStyle = .border
        return options
}

Here is a GIF I captured of it occurring:

naivezestygalah

Slow speed

Let me know if you have any advice

Andrew

Locking swiping from the left triggers prevention of Action

Hi,

First, thank you for this awesome kit!

I have one small issue. In my implementation of this kit, I used the provided code to cancel the left swipe:
guard orientation == .right else { return }

However, this code triggers this error in Xcode 8.2.1:
Non-void function should return a value

I fixed this error by adding [ ]:
guard orientation == .right else { return [] }

This worked fine as it locked swiping from left, however, I noticed that when someone tries to swipe from the left, (no action is taken), then swipes from the right on the same cell or tap on it, no action is taken too. If he swipes/taps again, then, the right swipe action or the tab action works fine.

Is there a way to make this locked left swipe does not cause this temporary prevention of action?

Thank you

leak

you can run swipeCellkit project use Instruments you can see
2017-06-04 10 36 48
.you must set Debug infomation format
2017-06-04 10 39 25
Thanks

Request: Additional Expansion Style

I would love for there to be another expansion style. Similar to the Destructive style where the entire cell expands, but without the destructive properties. It would be useful for single, left side actions to transition to a new view controller or detail view.

Please let me know if this is possible with the existing expansion styles and I am missing something.
Thanks

Andrew

Swiping left while holding down to select cell causes issue

Currently, if I have the cell's Selection set to Default, and I press and hold down on the cell to select it, then perform a left swipe to reveal the SwipeAction buttons, the selected cell's background color is stuck on gray, and all the cell's properties (UILabel, etc.) that was set in the code defaults to the value set in StoryBoard.

I think it's a bug possibly?

@jerkoch you can test it out with the sample project

Test.zip

Table view gestures breaking in iOS 11

Hi,

I'm noticing strange behavior after the Extensions method "setGestureEnabled" gets called in iOS 11. It seems to break all tap gesture recognition in iOS 11. It looks like commenting this out fixes the issue for now...and doesn't actually seem to break anything in iOS 10.

Just reporting this as additional info for the betas.

Btw, your library is great. I'll most likely continue using it, even though iOS 11 provides similar functionality. I've liked it a lot.

Thanks,

  • Conrad

Play nice with iOS 11

It would be nice if SwipeCellKit could work together with the similar system in iOS 11. I would like to use SwipeCellKit as a fallback for earlier versions of iOS, but right now that does not work since cells get unresponsive when a cell inherit from SwipeCellKit's UITableViewCell's subclass.

UICollectionViewCell

Nice library when wanting more than possible with tableView(_:editActionsForRowAt:). Would it be possible to adopt this in order to work with UICollectionViewCell?

UI bug

Hello! Thanks for this framework. I downloaded the sample to see how to use this framework, and found a bug. If I select a cell, that it is not read, and when I click on the Edit button, the indicator (that the cell is not read) will blend into the text.

img_1045

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.