var pop not recognized; Xcode recognizes function pop()

In mij project I use a var pop = [[String]] with popmusic radiostations. The var is declared in a separate file.

var pop2 = [dobbelsteen, spice, achttienHits, tweefm, axl, dolfijnfmtop40, glowFM, haarlem105, heteHits, jey, megahitFM, nonstoptop40, radio3, qmusicnl, qmusicnltop40, radio538, radio538Top50, skyradiolive, todaysHitradio, wildFM]

Using that var in iOS code works ...

lijstGeselecteerd = pop

but using it in watchOS gives the following error: Cannot assign value of type '() -> Void' to type '[[String]]'. Xcode thinks I refer to the function pop(). But I want to refer to de var pop.

Is it possible to refer explicitly to the var?

Answered by Claude31 in 721377022

var pop is declared in a class ?

If so, prefix with Class name

lijstGeselecteerd = MyClass.pop

If it is defined at toplevel, prefix with targetName (usually the app name)

Accepted Answer

var pop is declared in a class ?

If so, prefix with Class name

lijstGeselecteerd = MyClass.pop

If it is defined at toplevel, prefix with targetName (usually the app name)

var pop not recognized; Xcode recognizes function pop()
 
 
Q