I'm new to Swift sorry if this might seem too simple. But I could not find answer from anywhere.
I am trying to understand this syntax below. The code have = then {..}() why need () at the end and also = sign for ?
var productLines: [ProductLine] = { return ProductLine.productLines() }()
I understand that computed variable would be something like .. this below
var varA: [arrayOutput] { return someArray }
what exactly is ={ return something }() called or mean in swift ?
{ ... }is a closure (an inline function definition).()calls that function`.productLinesinitially with the result of the closure{ return ProductLine.productLines() }The()calls that closure function. So the value ofproductLinescan be overwritten later. So no, this is not a computed property.