I'm trying to utilize Apple's new TipKit
where I still support iOS16. Is there a way to initialize the Tip without making the entire struct as @available(iOS 17, *)
. Example being
struct MainHomeEntryView: View {
var myTip = MyTip()
....
}
error: 'SubmitTip' is only available in iOS 17 or newer
We had the same problem and came up with this small helper:
With it, you only need a minimal amount of
if #available
checks. You only have to let your tip conform toTipShim
:and then you can use it like this: