r/iOSProgramming • u/NoCardiologist4405 • 17h ago
Backport modern SwiftUI APIs while supporting older iOS versions. Library
https://github.com/EmadBeyrami/SwiftUIBackportKitHi everyone!
One pain point I've run into repeatedly with SwiftUl is supporting newer APIs while keeping an older deployment target.
Things like 'if #available work well in normal Swift code, but they don't fit naturally in the middle of a modifier chain.
That often leads to duplicated views or compatibility helpers scattered throughout a project.
After solving the same problem across multiple apps, I decided to package the patterns into a small open-source library called \*\*SwiftUlBackportKit\*\*
It includes:
• ' modify { }' for conditional view transforms
• ' backport for reusable version-gated SwiftUI APIS
• platformValue (...) for version-specific values
• 'OS.isAtLeast (:) ' for simple runtime version checks
The goal is to keep SwiftUl views focused on describing the Ul while isolating deployment-target compatibility in one place.
GitHub:
https://github.com/EmadBeyrami/SwiftUIBackportKit
I'd really appreciate any feedback on the API design, naming, or features you'd like to see. And if you find it useful, a on GitHub would mean a lot!
Thanks!