PreventScreenshot

0.0.1

This package adds a modifier to your SwiftUI elements to prevent screenshots. This is useful for apps that display sensitive information and want to prevent users from taking screenshots.
0xWDG/PreventScreenshot

What's New

0.0.1

2024-07-23T19:23:05Z

preventScreenshot allows you to prevents screenshots of a SwiftUI Element.

preventScreenshot

preventScreenshot allows you to prevents screenshots of a SwiftUI Element.

Swift Package Manager License

Requirements

  • Swift 5.9+ (Xcode 15+)
  • iOS 13+, macOS 10.15+, tvOS 15+, visionOS 1+

Installation (Pakage.swift)

dependencies: [
    .package(url: "https://github.com/0xWDG/preventScreenshot.git", .branch("main")),
],
targets: [
    .target(name: "MyTarget", dependencies: [
        .product(name: "preventScreenshot", package: "preventScreenshot"),
    ]),
]

Installation (Xcode)

  1. In Xcode, open your project and navigate to FileSwift PackagesAdd Package Dependency...
  2. Paste the repository URL (https://github.com/0xWDG/preventScreenshot) and click Next.
  3. Click Finish.

Usage

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()
    }
}

Contact

We can get in touch via Twitter/X, Discord, Mastodon, Email, Website.

Description

  • Swift Tools
View More Packages from this Author

Dependencies

  • None
Last updated: Sun May 04 2025 01:27:03 GMT-0900 (Hawaii-Aleutian Daylight Time)