jeudi 28 janvier 2021

Is there any design pattern suitable for "Button to Action” screen?

It's taken from interview question. You have button in the center of UIViewController that when tapped, returns one of actions enum types. Depending on the action there should be different behaviour. Like:

  1. Change button color.
  2. Send email.
  3. Show local notification.

In future there should be more complex actions that either change UIViewController or use native or 3rd party libs. Because there is nothing common between those action, I would just write simple Switch and do everything inside UIViewController. Do you know a smarter way?

Aucun commentaire:

Enregistrer un commentaire