For Sept 2015, here\'s exactly how you make a singleton in Swift:
public class Model
{
static let shared = Model()
// ( for ocd friends ... privat
I can't see a single downside to this approach:
Model.shared.test() doesn't really make sense if you think about it, you just want to call test, why would I need to call shared when I just need a function.In general, setting aside the exact idiom under discussion, regarding the use of singletons:
static var shared = Model() as a kind of macro to a singleton, as suggested in this Q, you can just define let model = Model() which simply creates a normal global (unrelated to singletons).private init() {} to your class, so that it only gets initialized once (noting that init could still be called in the same file).