dimanche 7 août 2022

Swift Repository Design Pattern Quetion

Good Morning, I'm trying to implement Repository Design Pattern In my application as an iOS SWIFT developer.

I wonder if my way of implementation is good practice in software engineering ( trying to be better and better )

I use Generic programming in the repository and don't use a Manager for every model, it's a single manager that takes ownership of all basics CRUD database operations, so let's stop talking and see the code.

Database Manager that owns all operations

Main Database Manager Definition

Example Of Database Manager Functions

Code Inside Main Database Manager Class

My Way to use in Presenter ( Using MVP for this project )

Definition of the Database Manager with the type I need

Example of functions use cases in Presenter

Use Case of database manager in presenter

Example of functions used by another presenter

Use Case of database manager by another presenter

Receive add password Event from another view Controller in the main Presenter without the need to refresh the passwords list and re-fetch from the database (Look at picture number 4)

Function add, in another Presenter

I hope the question is clear.

Aucun commentaire:

Enregistrer un commentaire