ios - Xcode not recognizing declared variable? -


this question has answer here:

i have created new class within controller file such :

import uikit  class firsttableviewcontroller: uitableviewcontroller {  class sport {      var name: string = "sport name"     var branches: nsarray = [" branches of sport"] } 

now when try create new object class, works expected:

 var americanfootball = sport() 

however when try access 1 of properties class change, doesn't recognize new object:

enter image description here

whats issue ?

you should access property inside function.

import uikit  class firsttableviewcontroller:uitableviewcontroller {  class sport {      var name: string = "sport name"     var branches: nsarray = [" branches of sport"] }    var americanfootball = sport()//this property of firsttableviewcontroller      override func viewdidload() {         americanfootball.name = "another"    }  } 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -