samedi 11 avril 2015

Swift design patterns: looking for more idiomatic alternatives to my Authorised Singleton impl

As a Swift learning project, I've built a little framework providing a base class for manager type singletons which rely on authorisation dependent APIs such as PhotoKit and CoreLocation.


Problem: I've had to twist and hack around multiple times, and I fear my solution isn't the most idiomatic. Coming from a C# background, I've tried to apply quite restrictive patterns, hiding as much of the implementation as possible to clients.


I'd love to get input on how to achieve similar behaviour in a more idiomatic and elegant fashion. I realise this may qualify as a question attracting opinion based answers, but I've taken care in the linked GitHub repository's readme to list specific points where I've had to commit ugly, un-Swiftly sins. I hope these points are specific enough to warrant specific answers.


http://ift.tt/1Np5OhE


Aucun commentaire:

Enregistrer un commentaire