Q:

EXC_BAD_ACCESS when declaring a variable

As i said, I get an error when I declare a variable. I can't find any solution weither on Google nor on Swift docs.
Heres the code:
class Database {
static let si = Database() // when removed it also resolves into an error

init() {
    print("Hello") // isn't printed.
    self.setONs() // see code below to see where collected gets a new value
    print("current device id: \(UIDevice.current.identifierForVendor!.uuidString)") // resolves into an error when declared as uuid which is now "TestUID"
}

var uuid: String = "TestUID" // its actual the device id.
var gkid: String = "" // GKPlayerID
var collected: [String : [String : Int]] = [:] // <- Thread 1: EXC_BAD_ACCESS(code=2,address=0x7fff59de4f8)
private var collectedProgress: [String : [String : Int]] = [:]

If I remove collectedProgress the bad access occurs on collectedProgress. Both Variables are only declared and not written or read. Even if I remove the collectedProgress variable too the next variable occurs the same error.

A:

I solved the issue. I am not 100% sure if this was the error but for now theres no EXC_BAD_ACCESS.
I added a sharedInstance in Database() and replaced Database() in other Classes/Objects with Database.sharedInstance. Now all objects uses the same object. 
The receiver in Database ( SocketIOManager.sharedInstance.on("") {}) could be the problem. Since they receive new values for the variables and some more, but as they where commented the error occurred also.
I hope you'll not get the same error/problem as I had with your code.
Thank you also for your help.
Fixed code on Github

