ios - ViewController Type does not have member named -
i searched similar questions none seemed answer issue. making single view app. in class viewcontroller: uiviewcontroller section have following code:
var lasttoact = 0 var gamestarted = false var tempplayer = baseplayer() var positionnumber : int = 0 var stringposnum : string = string(positionnumber) var stringfrominteger : string = "\(string(positionnumber))"
the first 5 variables no error 6th , 7th ones viewcontroller type' not have member named' positionnumber last 2 variables. don't know why is.
var stringposnum : string = string(positionnumber)
the problem stored instance variable default value depends on value of another instance variable. can't that, because @ instantiation time, when default value applied, there no other instance variables, because there no instance yet — instance in middle of creating.
one solution: put lazy
in front of declaration. solution: if variable have relation other instance variable, make computed variable instead of stored variable.
Comments
Post a Comment