Addressing the terminology here…
What we commonly call "functions" and "closures" are both just functions to the compiler. The only important difference is that a function declared via the func … { … } syntax is a named function, and a closure is an unnamed function.
Let's say you have a named function in your struct:
struct ShowsBuilder2 {
static func showsInitialValue() -> [String] {
return [
"100 Stories About OneNight",
"Ocean Express"
]
}
static var showsLiteral: [String] = showsInitialValue()
}
If you think of the syntax static func showInitialValue() -> [String] as the "name" of the function and then set that aside for a moment, you'll see that what's left is the part in the braces, which is the same as the closure that you originally wrote.
This is not an accident. Using a named function is really the same as using a closure, apart from a bit of ceremony in writing the name of the function.
That's also why you needed () after the closure. If you tried to write this:
static var showsLiteral: [String] = showsInitialValue // <- no parens
you'd get the same compiler error, but in this case your intuition about using functions would make it clear why you need the parens — you want to apply the function here, to determine its returned value, not just mention the function.
Incidentally, I think it's a kind of bug in the compiler (in the wording of the error message) to use "function" indiscriminately for named and unnamed functions, since we normally use the informal "function"/"closure" terms instead. Might actually be worth a bug report.
Understood, and nobody here minds that you ask. Your questions are on-topic for this forum, so it's right that you come here for information like this.