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

gcc - MinGW's ld cannot perform PE operations on non PE output file -

timeout - Handshake_timeout on RabbitMQ using python and pika from remote vm -

c# - Search and Add Comment with OpenXML for Word -