Trying to come up with a solution to manage the states of different components within the app. Have multiple software, and hardware components some of which are written in C++, others in Objc, and yet others in Swift. Very close to coordinator pattern where I would want commands to be processed through this object in the future, but for now it just needs to be aware of all the different states of all the objects in the system and be able to report on the state of the system at any given time. Leaning towards using observer/notifications where all components register together with their state through notifications. Where an object (struct) implements some protocol, or perhaps userInfo has key-value pairs but then there is no type checking. Obviously, the alternative is for an object in the notification to be a reference to an actual object but then there is an issue of thread safety.
An alternative is to register delegates and query for the state as needed, but then there is an issue with thread safety and access to objects and their states. Can anyone point out to proposed pattern/solution with multi-treading in mind and given requirements, the pros/cons of notifications vs delegation?
vendredi 21 juillet 2023
coordinator like pattern for state management in iOS swift/objc/c++ based app
Inscription à :
Publier les commentaires (Atom)
Aucun commentaire:
Enregistrer un commentaire