I am trying to write a function that creates a shape according to a specified condition but getting a compilation error.
func createShape() -> some Shape {
switch self.card.shape {
case .oval:
return Capsule()
case .rectangle:
return Rectangle()
case .circe:
return Circle()
default:
return Circle()
}
}
The error I am getting:
Function declares an opaque return type, but the return statements in its body do not have matching underlying types