On Aug 28, 2020, at 12:55 PM, Rick Aurbach via groups.io <firstname.lastname@example.org> wrote:
I have what must be a common problem, and am looking for some architectural suggestions.
Over the years, I've built custom objects (e.g., popup calendars, button menus, etc) which have now been added to iOS as of iOS 14. This presents a problem for me, because I want my apps to support pre-14 systems. What I want to implement is:
An @IBDesignable object which implements a custom class on pre-14 systems, but implements the new iOS-14 objects on 14+.
The object must compile and build with a deployment target of 12.0. Obviously this means that I need to use @available and #available to make the link work.
Check Objective-C headers in teh foundation classes. In there, you can see how you can declare a function’s availability to certain OS versions. Once you see how Apple does it in Objective-C, you can also check out the Swift headers and branch to the functions you want to in your wrapper.