Introduction
Welcome to the documentation for DefendScreenshot, a powerful library that helps protect sensitive information displayed on iOS device screenshots. This library offers developers an easy-to-use solution for safeguarding user data and preventing unintended leaks through screenshots.
Table of Contents
Installation
To use DefendScreenshot in your iOS project, follow the steps below:
- Open your project in Xcode.
- Navigate to the target configuration window (by clicking on the blue project icon).
- Select the ‘Build Phases’ tab.
- Expand the ‘Link Binary With Libraries’ section.
- Click the ‘+’ button and add the DefendScreenshot.framework.
- Import the DefendScreenshot module in your Swift or Objective-C source file.
Usage
Step 1: Initialization
To start using DefendScreenshot, initialize it in your app’s entry point as shown below:
import DefendScreenshot
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
DefendScreenshot.shared.start()
return true
}
Step 2: Enabling/Disabling Protection
You can enable or disable the screenshot protection at any time during runtime using the following methods:
// To enable screenshot protection
DefendScreenshot.shared.enable()
// To disable screenshot protection
DefendScreenshot.shared.disable()
Step 3: Controlling Activation
DefendScreenshot allows you to choose when to activate the screenshot protection. To respond to specific events, implement the following delegate method:
func defendScreenshotAccessDetected() {
// Take appropriate action here (e.g., presenting a warning message)
}
Configuration
DefendScreenshot provides customizable options to fit your application’s requirements.
Setting the Shield Color
You can customize the shield color by setting the appropriate RGB values. To do this, use the following code snippet:
// Customizing shield color
DefendScreenshot.shared.shieldColor = UIColor(red: 0.65, green: 0.65, blue: 0.65, alpha: 0.8)
API Reference
DefendScreenshot offers the following API methods:
DefendScreenshot.shared.start()
Starts the DefendScreenshot protection.
DefendScreenshot.shared.enable()
Enables the DefendScreenshot protection.
DefendScreenshot.shared.disable()
Disables the DefendScreenshot protection.
DefendScreenshot.shared.shieldColor
The color of the shield overlay.
FAQ
1. Can I use DefendScreenshot in my Objective-C project?
Yes, DefendScreenshot is compatible with both Swift and Objective-C projects.
2. Does DefendScreenshot work on all iOS devices?
DefendScreenshot is compatible with iOS devices with iOS 11 and above.
3. Can I customize the shield color?
Yes, you can customize the shield color using the DefendScreenshot.shared.shieldColor property.
4. Does DefendScreenshot affect performance?
DefendScreenshot has been designed to have minimal impact on performance. Extensive testing has been done to ensure smooth user experience.
For more information, refer to the official documentation of DefendScreenshot.