swift - Why are class stored properties not supported in classes? -


basically, swift not allow me -

//class stored properties not supported in classes did mean 'static'.

class var hello = "hello" 

however fine -

static var hi = "hi" 

i know difference between class , static in swift class variables cannot store stored properties, while static variables can. however, fundamental difference between class , static variables static variables cannot overridden in subclasses, while class variables can. functionality wish keep.

i know simple fix issue make computed property using hacky fix -

class var greeting : string {     return "greeting" } 

this solve problem, , hope helps people online well. however, know if knows why swift behaves way, , not allow stored properties in class level variables.

seems swift has not implemented yet assuming per compiler error

"class stored propertied not supported in class"

enter image description here


Comments

Popular posts from this blog

javascript - Create a stacked percentage column -

Optimising Firebase database by automatically overwriting data -

javascript - Angular UI-Grid customTemplate directive causing rows to load slowly/? -