xcode - ViewController.Type does not have a member named -


just simple task, i'm in trouble. trying make different way fails.

enter image description here

how init nstimer declared variable? neither var nor let helps.

the initial value of property (in case: timer) cannot depend on property of class (in case: interval).

therefore have move assigment timer = nstimer(interval, ...) method of class, e.g. viewdidload. consequence, timer has defined optional or implicitly unwrapped optional.

note selector(...) takes literal string argument, not method itself.

so should work:

class viewcontroller: uiviewcontroller {      var interval : nstimeinterval = 1.0     var timer : nstimer!      func timerredraw() {      }      override func viewdidload() {         super.viewdidload()         timer = nstimer(timeinterval: interval, target: self, selector: selector("timerredraw"), userinfo: nil, repeats: true)          // ...     }      // other methods ... } 

Comments

Popular posts from this blog

symfony - TEST environment only: The database schema is not in sync with the current mapping file -

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -