I have been writing SwiftUI since day one, and even got lucky enough to start writing a production app in SwiftUI 2.0. Shortly after, I had another SwiftUI project but we had to support iOS 13+. This uncovered a fairly significant issue, SwiftUI 1.0 was missing a lot of key APIs.

By popular demand I’m going to post some tutorials on how I write these backports and understanding how to wrap UIKit properly. Including some nice patterns that simplify the boilerplate.

So I set set out trying re-writing APIs, keeping as closely as possible (essentially mirroring) to Apple’s official APIs. Since then I’ve written a couple dozen backports including some really key View‘s:

  • AsyncImage
  • ProgressView
  • Refreshable
  • ShareLink

Modifier‘s:

  • onChange
  • presentationDetents
  • presentationDragIndicator
  • navigationDestination
  • task
  • background
  • overlay

PropertyWrapper‘s

  • AppStorage
  • ScaledMetric

and many many more.

The result, I’ve written some fairly high quality backports that actually include support for all platforms (where applicable), maintain official documentation and even have associated @availability attributes to ensure you know when its time to step up to the official API.

The package also includes a convenient type Backport, conceptualised by Dave DeLong. This makes discovery and maintainability so much easier. Simply type backport in place of a type, modifier or environment key and you’ll be greeted with a myriad of backports 😬

Please checkout the library SwiftUIBackports and let me know what you think on @twitter. I’m also open to contributions and I’d love to hear about how you use the library in your own code 👍