mercredi 8 juillet 2020

iOS: How can I reduce Storyboard & Code duplication?

I am currently developing a Scheduling app for fun, and in the App I want to have templates for a given day that can be loaded in, this will reduce creating each day from scratch, if there are specific things someone does daily.

This is currently what my Storyboard looks like with the App Screen

I want to add a UIButton which will change the state of the App into "Template" mode. From there I would like to be able to add tasks as I already do, and have them save to a JSON file. Users will also be able to "import" their template to the current day. I know how to do all that, but the thing I'm curious about is how would I go about creating this Template "state". Would it make more sense to create two duplicate Storyboard ViewControllers with some duplicate controller code? Or would that be considered bad practice? How could I switch between this "template state" and "normal schedule state"?

The layout of the Template state and the normal schedule will have the exact same UI Elements in the exact same place. I'm pretty much asking for the best way to tackle this, be that a specific design pattern or something along those lines.

Thank you!

Aucun commentaire:

Enregistrer un commentaire