lundi 30 mars 2015

Shared builder pattern on iOS?

I'm struggling now with a dilema in my project and really can't help myself with finding proper solution. Here's the problem:


I have to POST some object to the backend using RESTful API but this object contains of many properties which can be filled across many different views. I don't want to make a call to the API everytime I fill another property but instead I want to gather all info and send this request once.


I thought about a builder pattern but I'd like to have it as a singleton so I won't have to pass everything from view to view... But is it a good approach? I thought that once I finish collecting properties and called [builder build] I'd nill all of those properties.


I don't like the idea of having many properties in my API methods and also I hate the idea of passing properties across many views until user tap on send or so on.


Could you guys give my a hint?


Aucun commentaire:

Enregistrer un commentaire