https://github.com/prongbang/screenprotectorkit
Safe Data Leakage via Application Background Screenshot and Prevent Screenshot for iOS.
https://github.com/prongbang/screenprotectorkit
ios ios-prevent-screenrecord ios-screenshot ios-snapshot prevent-screenrecord prevent-screenshot-ios prevent-snapshot
Last synced: 6 days ago
JSON representation
Safe Data Leakage via Application Background Screenshot and Prevent Screenshot for iOS.
- Host: GitHub
- URL: https://github.com/prongbang/screenprotectorkit
- Owner: prongbang
- License: mit
- Created: 2022-02-19T10:57:10.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-04-27T03:09:10.000Z (6 months ago)
- Last Synced: 2025-10-04T18:48:47.416Z (14 days ago)
- Topics: ios, ios-prevent-screenrecord, ios-screenshot, ios-snapshot, prevent-screenrecord, prevent-screenshot-ios, prevent-snapshot
- Language: Swift
- Homepage:
- Size: 27.3 KB
- Stars: 33
- Watchers: 1
- Forks: 9
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ScreenProtectorKit 🛡️
[](https://swift.org)
[](https://developer.apple.com/ios/)
[](https://cocoapods.org/pods/ScreenProtectorKit)
[](https://swift.org/package-manager/)
[](LICENSE)> Secure your iOS app's sensitive data by preventing screenshots and protecting background app snapshots with ease.
## ✨ Features
- 📸 **Screenshot Prevention** - Detect and handle screenshot attempts
- 🖼️ **Custom Background Protection** - Replace app preview with custom content
- 🎨 **Multiple Protection Styles**:
- Blur effect
- Custom image
- Solid color
- 🎬 **Screen Recording Detection** - Know when screen is being recorded
- 🚀 **Easy Integration** - Simple API with clear documentation
- 📦 **Multiple Installation Options** - CocoaPods and Swift Package Manager support## 📦 Installation
### CocoaPods
Add to your `Podfile`:
```ruby
pod 'ScreenProtectorKit'
```Then run:
```bash
pod install
```### Swift Package Manager
Add to your `Package.swift`:
```swift
let package = Package(
dependencies: [
.package(url: "https://github.com/prongbang/ScreenProtectorKit.git", from: "1.3.1"),
],
)
```Or via Xcode:
1. File → Add Packages...
2. Enter package URL: `https://github.com/prongbang/ScreenProtectorKit.git`
3. Select version: `1.3.1` or later## 🚀 Quick Start
### Basic Setup
```swift
import ScreenProtectorKitclass AppDelegate: FlutterAppDelegate {
private lazy var screenProtectorKit = {
return ScreenProtectorKit(window: window)
}()
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
// Configure screenshot prevention
screenProtectorKit.configurePreventionScreenshot()
return true
}
}
```## 📱 Protection Methods
### 1. Screenshot Prevention
Detect and respond to screenshot attempts:
```swift
override func applicationDidBecomeActive(_ application: UIApplication) {
screenProtectorKit.enabledPreventScreenshot()
}override func applicationWillResignActive(_ application: UIApplication) {
screenProtectorKit.disablePreventScreenshot()
}
```### 2. Blur Background Protection
Apply blur effect when app goes to background:
```swift
override func applicationDidBecomeActive(_ application: UIApplication) {
screenProtectorKit.disableBlurScreen()
}override func applicationWillResignActive(_ application: UIApplication) {
screenProtectorKit.enabledBlurScreen()
}
```### 3. Image Background Protection
Show custom image when app is in background:
```swift
override func applicationDidBecomeActive(_ application: UIApplication) {
screenProtectorKit.disableImageScreen()
}override func applicationWillResignActive(_ application: UIApplication) {
screenProtectorKit.enabledImageScreen(named: "LaunchImage")
}
```### 4. Color Background Protection
Display solid color when app is in background:
```swift
override func applicationDidBecomeActive(_ application: UIApplication) {
screenProtectorKit.disableColorScreen()
}override func applicationWillResignActive(_ application: UIApplication) {
screenProtectorKit.enabledColorScreen(hexColor: "#ffffff")
}
```### 5. Screen Recording Detection
Check if screen is being recorded:
```swift
let isRecording = screenProtectorKit.screenIsRecording()
if isRecording {
// Handle screen recording scenario
}
```## 💡 Usage Examples
### Complete Implementation
```swift
import ScreenProtectorKitclass AppDelegate: FlutterAppDelegate {
private lazy var screenProtectorKit = {
return ScreenProtectorKit(window: window)
}()
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
// Setup screenshot prevention
screenProtectorKit.configurePreventionScreenshot()
// Handle screen recording if needed
if screenProtectorKit.screenIsRecording() {
showRecordingWarning()
}
return true
}
override func applicationDidBecomeActive(_ application: UIApplication) {
// Enable screenshot prevention
screenProtectorKit.enabledPreventScreenshot()
// Remove protection overlay
screenProtectorKit.disableBlurScreen()
}
override func applicationWillResignActive(_ application: UIApplication) {
// Disable screenshot prevention
screenProtectorKit.disablePreventScreenshot()
// Add protection overlay
screenProtectorKit.enabledBlurScreen()
}
private func showRecordingWarning() {
// Show alert to user about screen recording
}
}
```## ⚠️ Important Notes
- Screenshot prevention on iOS works by detecting attempts, not blocking them entirely
- Background protection helps prevent data leaks in app switcher
- Screen recording detection only indicates if recording is in progress
- Test thoroughly across different iOS versions and devices## 🔧 Requirements
- iOS 13.0+
- Swift 5.5+
- Xcode 13.0+## 🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
## 📄 License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## 💖 Support the Project
If you find this package helpful, please consider supporting it:
[](https://www.buymeacoffee.com/prongbang)
## 🔗 Links
- [Documentation](https://github.com/prongbang/ScreenProtectorKit/wiki)
- [Example Project](https://github.com/prongbang/ScreenProtectorKit/tree/main/Example)
- [Report Issues](https://github.com/prongbang/ScreenProtectorKit/issues)---