I am trying to apply a variable based type. The example below does not say "Using an undeclared type, myType"
protocol Parent {} protocol Child: Parent {} struct Foo: Child {} let foo: Parent = Foo() let myType = Child.self if let _ = foo as? myType { print("success") }
Is there a casting method based on myType variable?
source share