swift - Cant access model data in my viewcontroller -


trying access array of structs main controller. doesn't work though? guesses why? note: deckofcards enum , decks array of structs.

// model.swift class model {      var decks:[deckofcards]     init(decks:[deckofcards]) {          self.decks = decks         decks = [deckofcards(carddigit: 0), deckofcards(carddigit: 1), deckofcards(carddigit: 2)     }  }  /* class variable allowing me access without first instantiating model. can retrieve model without instantiating directly  var model = model.sharedinstance */ class var sharedinstance: model {     if !(static.instance != nil) {         static.instance = model()   <---error, missing parameter decks in call     }     return static.instance! } 

controller file (not working)

var thiscard = model.sharedinstance.decks 

following println doesnt work

println(thiscard.decks.count) 

your model accepts decks not passing when create new instance of model.


Comments