Search code examples
iosswiftuitableviewios11

For UITableView do I need to implement trailingSwipeActionsConfigurationForRowAt and/or editActionsForRowAt?


iOS11 introduced trailingSwipeActionsConfigurationForRowAt (and leading...). Does that mean I now have to implement

  1. the trailing/leading methods to control swiping for iOS11 AND
  2. editActionsForRowAt for iOS10?

How to get the simulator to run iOS10 simulations to see how my app behaves in the back level OS? Since everything is now iOS11, I'm not sure how my app will be in that version?

To clarify: I want actions for rows, but I don't want the default behaviour in iOS11 of performsFirstActionWithFullSwipe. If I just implement editActionsForRowAt then iOS11 does the full swipe.


Solution

  • If you want some form of row actions, you need to:

    Implement just editActionsForRowAt and it will work for iOS 10, 11, 12 and 13. But it's NOT available in iOS 14 (or newer).

    or:

    Implement editActionsForRowAt on iOS 10, and implement the trailing/swiping methods on iOS 11 or newer - which are slightly fancier.

    or:

    Ignore iOS 10 and only support iOS 11 or newer trailing/swiping actions since most of your customers will likely be running iOS 11 anyway - and row actions are generally considered an optional feature anyway.


    If you don't want the full swipe behavior, you can only achieve this on iOS 11 or newer where you can set performsFirstActionWithFullSwipe to false


    Full swipe methods aren't available until iOS 11. They won't work in iOS 10.