How do I specify a conditional availability of a type or an extension, etc, so that either my version or the OS version is getting used depending upon OS version? Example pseudo code (doesn't compile):
@available (iOS, unavailable: 15)
enum HorizontalEdge {
case leading, trailing
}
@available (iOS, unavailable: 15)
extension View {
func swipeActions<T>(edge: HorizontalEdge = .trailing, allowsFullSwipe: Bool = true, @ViewBuilder content: () -> T) -> some View where T : View {
self // do nothing until iOS 15
}
}
I can think of a more cumbersome solution that uses a different name for "swipeActions", say "swipeActions2" and either calls through OS "swipeActions" on iOS15+ or does nothing on elder systems. Although if there is a way to solve this keeping the name as is, I'd like to do that to keep the main app code as undisturbed as possible (that's why i don't want pollute the main app code base with #if's availability blocks scattered here and there).
Nice. Something is not entirely right here though as I can't specify two buttons inside one "swipeActions" block (although I can workaround it by placing them into two separate swipeActions blocks). figuring out..