[Solved] Singleton class with instance variable and methods in Swift (iOS)


i got the solution, when i tried this, worked fine!

class ABC_Util {

 var doesValueExists:Bool = false
 var arrValues:NSMutableArray? = nil


class var sharedInstance: ABC_Util 
{
    struct ABC_UtilSingleton 
    {
        static let instance = ABC_Util()
    }

    return ABC_UtilSingleton.instance
}

init() {

    self.doesValueExists = self.checkValueExists()
    self.arrValues = self.getArrayOfValues()
}

//method
internal func checkValueExists()-> Bool
{
    //return true/false
}

//method
internal func getArrayOfValues()-> NSMutableArray?
{
    //return array/nil
}

}

solved Singleton class with instance variable and methods in Swift (iOS)