In WWDC 2019 session 402 "What's New in Swift", the speaker, when discussing the Swift 5.1 feature Opaque Result Type (SE-0244), mentions that the feature will only work on new OSes:
Requires new Swift runtime support
Available on macOS Catalina, iOS 13, tvOS 13, watchOS 6 and later
Guard uses with availability checking when deploying to earlier OS releases
In Xcode 11, I don't get any build errors (or warnings) if I write code using this feature, when targeting iOS 11 and up. I haven't wrapped any of the code in if #available(iOS 13.0, *) checks. E.g.:
protocol Shape { }
class Square: Shape { }
class Triangle: Shape { }
func foo() -> some Shape {
return Square()
}
and then calling foo() from some code in my app.
What happens if this code runs on pre-iOS 13 devices? Is the lack of build error itself an error? Is there a definitive list of which Swift 5.1 features require new runtime support, and thus a specific OS version?
