A SwiftUI library that helps protect sensitive content in your iOS apps by automatically hiding content when the app goes to the background or when a screenshot is taken.
- Multiple privacy styles to choose from:
- Default
- Redacted
- Blur
- Opacity
- Custom (with customizable color and corner radius)
- Automatic content protection when app goes to background
- Easy to use SwiftUI view modifier
- iOS 15+ support
Add the following dependency to your Package.swift file:
dependencies: [
.package(url: "https://github.com/kovs705/AccessDenied.git", from: "1.0.0")
]Or add it directly in Xcode:
- Go to File > Add Packages
- Enter the repository URL:
https://github.com/kovs705/AccessDenied.git - Click Add Package
Simply add the privacySensitive modifier to any view you want to protect:
import SwiftUI
import AccessDenied
struct ContentView: View {
var body: some View {
Text("Sensitive Content")
.privacySensitive(.blur)
}
}// Default style
.privacySensitive(.default)
// Redacted style
.privacySensitive(.redacted)
// Blur style
.privacySensitive(.blur)
// Opacity style
.privacySensitive(.opacity)
// Custom style with color and corner radius
.privacySensitive(.custom(color: .black, cornerRadius: 10))
// Disable privacy protection
.privacySensitive(.default, isEnabled: false)- iOS 15.0+
- Swift 5.9
This project is licensed under the MIT License - see the LICENSE file for details.
If you encounter any issues or have questions:
- Check the Issues page
- Create a new issue with detailed information
- Include device model, iOS version, and code samples
