misteu / VocabularyTraining

Simple vocabulary Trainer written in Swift
Apache License 2.0
22 stars 15 forks source link

[Refactor] Replace notification centre based communication for add card to delegation/closure based communication #28

Closed PranjalDev closed 1 year ago

PranjalDev commented 1 year ago

GOAL

To improve the code readability, testability communication between Language Screen and Add Word Screen

WHY

Current implementation broadcast a notification for communicating back and forth for when a word is added to refresh the list, Which could lead to issues where multiple such receivers could listen for this shared notification and we could not predict why something is updating, rather having a shared broadcast mechanism, we should have a direct delegation pattern which could be scaled to multiple receivers if needed be, but for current use case, Notification Centre looks a bit overkill, which probability of having a memory leak due to added notification listener in Language screen

ACCEPTANCE CRITERIA

Implementing a delegation pattern or a clousure based pattern to notify the Language screen when a new word is added.

bladebunny commented 1 year ago

Can I take this? I have a PR ready (https://github.com/misteu/VocabularyTraining/pull/33).

misteu commented 1 year ago

I'm closing this now as the #33 mentioned is merged.