preventScreenshot allows you to prevents screenshots of a SwiftUI Element.
- Swift 5.9+ (Xcode 15+)
- iOS 13+, macOS 10.15+, tvOS 15+, visionOS 1+
dependencies: [
.package(url: "https://github.com/0xWDG/preventScreenshot.git", .branch("main")),
],
targets: [
.target(name: "MyTarget", dependencies: [
.product(name: "preventScreenshot", package: "preventScreenshot"),
]),
]
- In Xcode, open your project and navigate to File → Swift Packages → Add Package Dependency...
- Paste the repository URL (
https://github.com/0xWDG/preventScreenshot
) and click Next. - Click Finish.
Example to read a ImageView (Multi platform):
import SwiftUI
import preventScreenshot
struct ContentView: View {
var body: some View {
VStack {
Text("Don't take a screenshot of this")
.preventScreenshot()
}
.padding()
}
}
We can get in touch via Twitter/X, Discord, Mastodon, Email, Website.