An open API service indexing awesome lists of open source software.

https://github.com/xing/unifiedactionhandling

A sample project for the CocoaHeads HH presentation in January 2018. It shows our approach to handle actions like cell and button taps in a unified way.
https://github.com/xing/unifiedactionhandling

Last synced: 12 months ago
JSON representation

A sample project for the CocoaHeads HH presentation in January 2018. It shows our approach to handle actions like cell and button taps in a unified way.

Awesome Lists containing this project

README

          

# Unified Action Handling

This is a sample project which contains the unified action handling we use in XING's iOS app. We presented this on the CocoaHeads Hamburg meeting in January 2018.

The idea is to unify handling the tapping of cells, the tapping of buttons, and 3D touches.

- Cells get a `selectionAction`, and a `previewAction`.
- Buttons can get a `action` (not shown in the sample yet).
- An action is of type `` in Objective-C, and `Action` in Swift.
- An action can be dispatched via several dispatch methods.
- Action handlers (blocks/closures) can be registered up the responder chain.

We have seen less need for delegation with this approach, which shaves of a couple of lines of code. Also, we can work with composition instead of inheritance, as registering an action handler does not require yet another subclass.