Tag: singleton


Swift first steps: Singleton

Next day next challenge, as simple as it may be – creating Singleton – it can bring some problems in now known language using not known syntax. Lucky enough I was able to write my first Swift class and make it a working singleton (I have wrote unit tests that will testify it). So let’s take a look and next explain.

import Foundation

class Singleton {
    static let sharedInstance = Singleton()
    private init() {}

Continue Reading..