Relatively new to Swift and struggling with the simplest of things. I wish to preallocate an array of structs set to default values. This works just as long as the struct is not nested inside another type. Any ideas? Here is simplified example:
struct PlainStruct
{
var yo:Float = 0.0
}
class WrapperClass
{
struct NestedStruct
{
var yo:Float = 0.0
}
}
// Works just fine
var a = [PlainStruct](count:2, repeatedValue:PlainStruct())
// Error - Cannot call value of non-function type '[WrapperClass.NestedStruct.Type]'
var b = [WrapperClass.NestedStruct](count:2, repeatedValue:WrapperClass.NestedStruct())
Thanks