During the process of developing a mobile app, I came several times to the point in which I needed to "wrap" some specific model instances to make them available to a delegate, very much the same way Apple makes use of MKAnnotation protocol and MKAnnotationView class.
Is there a name to this pattern, or is it simply a practical application of the protocol-oriented programming? Because my main concern is that if I give access to an object which is passed by reference (e.g. a class), I don't want the client to have write access to that instance, but only reads. Hence in this case, the use of a protocol declaring just get-only properties should have solved the problem, hasn't it?
Thank you very much!
Aucun commentaire:
Enregistrer un commentaire