ios - Swift error about consecutive declarations on a line -



ios - Swift error about consecutive declarations on a line -

i don't understand what's wrong code in view controller, bottom line (with single } bracket) keeps getting 2 errors, 1 states "consecutive declarations on line must separated ';'" , "expected declaration". when add together semicolon directs me still says expected declaration error....but what? can find wrong it?

import uikit class viewcontroller: uiviewcontroller { override func viewdidload() { super.viewdidload() // additional setup after loading view, typically nib. var testobject = pfobject(classname:"testobject") testobject["foo"] = "bar" testobject.saveinbackgroundwithtarget(nil, selector: nil) var votecount = pfobject(classname:"votecount") votecount["votes"] = 0 votecount["optionname"] = "crepes" votecount.incrementkey("votes") votecount.saveeventually() var query = pfquery(classname:"votecount") query.getobjectinbackgroundwithid("e8khneisfw") { (votecount: pfobject!, error: nserror!) -> void in if error != nil { nslog("%@", error) } else { votecount["votes"] = 1 votecount.incrementkey("votes") votecount.saveeventually() } } class counter { var votecount: int = 0 func incrementby(amount: int, numberoftimes times: int) { votecount += amount * times } } func didreceivememorywarning() { didreceivememorywarning() // dispose of resources can recreated. } }

there's missing closing brace before line:

class counter {

your viewdidload() method not closed, happens class , didreceivememorywarning defined local viewdidload.

a proper indentation reveals errors that... indenting code?

ios xcode swift declaration

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -