I have a class ServiceClass
, a closure function in this class eg LoginViaEmail
, calls APILayer
. APILayer
calls HttpLayer
and JSONHandler
and returns output to ServiceClass
. ServiceClass
further returns some info to ViewController
when completionblock
is received.
My questions are
- Shall I make
ServiceClass
as Singleton? But then everybody says that they are anti-pattern and not a good approach. - If they are so bad, why does Apple use them? eg NSFileManager, NSWorkspace, UIApplication etc,
- If not Singleton, then what shall I use? Make instance of
ServiceClass
every time I use it? Wouldn't that take too much memory?