I am rewriting one of my apps in Swift, that displays live weather data for South Kohala. Love Swift so far!
I\'m having one small problem that is holding things up
It is because List
is purely local to the inside of viewDidLoad
; where you've declared it, other methods cannot see it.
Contrast, for example, forecastsTable
, which is declared outside any method, which means that any method can see it.
This behavior is called "scope" and is crucial to any programming language. Variables declared inside a method are neither visible outside it nor do they persist when that method has finished running. Thus, in your example, not only is List
not visible when cellForRowAtIndex
runs, it doesn't even exist when cellForRowAtIndex
runs - it has been destroyed long before.