Can I advantage of Swift availability features in a UITableVIewDelegate?


Rick Aurbach
 

I am working on an app which I would like to support 10.x for the next release. The problem I have is in a UITableViewDelegate:
I have two actions which I'd like to implement for cells. In 10.x, I have to implement tableView(_:editActionsForRowAt:) and both action buttons show up on the same side of the cell. But in 11+, I can use tableView(_:leadingSwipeActionsConfigurationForRowAt:) and tableView(_:trailingSwipeActionsConfigurationForRowAt:) and the two action buttons on opposite sides of the cell.

I don't understand how to use @availabiltiy and/or #availability to implement the above requirement when I am implementing optional protocol functions. (I think I understand what to do when the conditional code is mine, but I'm not sure how this applies to implementation of optional protocol functions in system-defined protocols.)

Can you help?? Thanks,

Rick

Join {cocoa@apple-dev.groups.io to automatically receive all group messages.