If the underlying type doesn't change for each variable, you need generic struct:
struct Foo<SomeShape: Shape> {
var shape: SomeShape
...
}
Say, if what you want is to store Circle
, then change to Rectangle
on the same variable, you need type erasure.