BSSecureKit is a secure view component library for iOS applications that protects sensitive content from screenshots and screen recordings. It provides components for both UIKit and SwiftUI frameworks.
Screenshot Result | Actual Screen |
---|---|
![]() |
![]() |
- Secure Overlay: Protects sensitive content from screenshots and screen recordings
- Dynamic Security Control: Toggle security state on/off at runtime using
isSecure
property - iOS 13.0+ Support: Compatible with the latest iOS versions (tested up to iOS 26.0 beta 9)
- UIKit & SwiftUI Support: Works with both frameworks
- Simple Usage: Minimal code required to implement security features
dependencies: [
.package(url: "https://github.com/Bangs00/BSSecureKit.git", from: "1.1.0")
]
pod 'BSSecureKit', '~> 1.1.0'
You can clone the repository or download the ZIP file and add it directly to your project.
import BSSecureKit
// Basic usage
let secureView = BSSecureView()
let contentLabel = UILabel()
contentLabel.text = "Sensitive Information"
secureView.embed(contentLabel)
// Dynamic security control
secureView.isSecure = true // Enable security
secureView.isSecure = false // Disable security
// Alternative method using function
secureView.setSecure(true) // Enable security
secureView.setSecure(false) // Disable security
// With placeholder
let placeholderView = UIView()
let placeholderLabel = UILabel()
placeholderLabel.text = "Placeholder"
let secureView = BSSecureView()
let secureLabel = UILabel()
secureLabel.text = "Actual Sensitive Information"
secureView.embed(secureLabel)
placeholderView.addSubview(placeholderLabel)
placeholderView.addSubview(secureView)
import SwiftUI
import BSSecureKit
struct SecureContentView: View {
@State private var isSecured = true
var body: some View {
VStack {
// Regular content
Text("Regular Content")
.padding()
.background(Color.orange)
// Basic secure content (always secured)
BSSecureViewRepresentable {
Text("Sensitive Information")
.padding()
.background(Color.green)
}
// Secure content with dynamic control
BSSecureViewRepresentable(isSecure: isSecured) {
Text("Sensitive Information")
.padding()
.background(Color.green)
}
// Placeholder with secure content
ZStack {
Text("Placeholder")
.padding()
.background(Color.red)
BSSecureViewRepresentable(isSecure: isSecured) {
Text("Actual Sensitive Information")
.padding()
.background(Color.blue)
}
}
// Toggle button to control security state
Button(action: {
isSecured.toggle()
}) {
Text(isSecured ? "Secured" : "Not Secured")
.frame(maxWidth: .infinity)
.frame(height: 44)
.background(Color.blue)
.foregroundColor(.white)
.cornerRadius(8)
}
}
.padding()
}
}
This repository includes two example projects:
- Example-UIKit: UIKit implementation example
- Example-SwiftUI: SwiftUI implementation example
Each example demonstrates:
- Comparison between regular and secure content
- Basic secure view usage
- Combination of placeholder and secure content
- Dynamic security state control with toggle functionality
- iOS 13.0+ (tested up to iOS 26.0 beta 9)
- Swift 5.0+
- Xcode 12.0+
- iOS Physical Device (does not work on Mac)
This library has been tested on:
- iOS 13.0 through iOS 26.0 beta 9
- Both UIKit and SwiftUI implementations
Note: The security features only work on physical iOS devices. When testing on Mac, the secure overlay will not function as expected.
This project is licensed under the MIT License. See the LICENSE file for details.
Bug reports, feature requests, and pull requests are welcome!