class Singleton { static func get() { if( type._instance == null ) { type._instance = new type(); } return type._instance; } } /* Usage: class SoundManager is Singleton { func init() { } } var mgr = SoundManager.get(); //type is upvalue\preset value, like self */