You may prefer this?
In ViewController
For each child in children
child.displayTo(self)
In each class such as Address
Function displayTo(ViewController: target)
target.display(self)
This ought to work as the type of self will be precisely Address. You may be
able to turn this into a pr
> Is there any other elegant way to achieve the desired behavior without
> using `if-let + typecasting`?
One way is to use classes instead on structs and define display as a method on
those classes. I’m no Swift expert but I expect you may find value in making
display() into a protocol.
An