I have a problem to implementing the MVC pattern in iOS with Swift. According to the Apple documentation, there is a MVC schema:
I am fine with that but as you can see, when the model changes itself (an incoming message from a socket, for exemple) how is it supposed to notify the controller?
For instance, I have a chat application with a model that represents a list of messages. When the model receives a new message, how does it notify the controller? Is there a conventional way to do that?
Thanks
You can achieve this Model - Controller communication in two ways.
For detailed explanation I would recommend you to watch CS 193p MVC lecture. (https://www.youtube.com/watch?v=Cb8KtEI3ZaY)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With