SwiftSafeUI is a Swift package designed to streamline the management of deprecated SwiftUI APIs across iOS versions. It provides a clean and efficient way to handle deprecation logic, ensuring your app always uses the latest APIs while seamlessly falling back to older, deprecated ones when necessary.
As SwiftUI evolves, Apple frequently introduces new APIs and deprecates older ones. Supporting multiple iOS versions can lead to technical debt, as developers need to maintain compatibility without cluttering their code with version checks, conditional logic, and workarounds. Over time, this can make the codebase harder to maintain, slower to adapt to new changes, and more prone to bugs.
SwiftSafeUI simplifies this process by encapsulating deprecation handling into reusable components. It helps you:
- Use the latest SwiftUI APIs without worrying about breaking older iOS versions.
- Reduce boilerplate code by centralizing version checks and fallback logic.
- Maintain a clean and future-proof codebase while supporting a wide range of iOS versions.
- Minimize technical debt by providing a structured approach to deprecation handling, ensuring your code remains scalable and maintainable as SwiftUI continues to evolve.
- iOS 13.0+
- In Xcode, select Add Packages from the File menu.
- Enter
/~https://github.com/BaherTamer/SwiftSafeUI
in the search field. - Click Add Package (Set the Dependency Rule to Up to Next Major Version)
- After adding the package, you will be able to import SwiftSafeUI in your project by using.
import SwiftSafeUI
Add a dependency in your Package.swift
dependencies: [
.package(
url: "/~https://github.com/BaherTamer/SwiftSafeUI.git",
.upToNextMajor(from: "1.4.0")
)
]
For detailed usage examples, instructions, and tips, visit the SwiftSafeUI Documentation.
If this project has been helpful to you, consider giving it a ⭐ on GitHub! Your support encourages continued development and improvements. We appreciate it!
SwiftSafeUI is available under the MIT
license. See the LICENSE file for more details.