GitXplorerGitXplorer
m

SwiftUI-Unscreenshottable

public
20 stars
6 forks
1 issues

Commits

List of commits on branch main.
Verified
a733dd92213e09a2e69fe68cca0d564a0d58c32b

Add files via upload

mmarkiv committed 7 months ago
Verified
39257ff75457d6e0582aee71a14c3170d7b87d73

Update swift.yml

mmarkiv committed 7 months ago
Verified
f7640503b010d84a9e103fd5f013285d2284ba66

Update swift.yml

mmarkiv committed 7 months ago
Verified
1a35f82773c46a0f1dcef578e3793dd4af2acb55

Bump down swift-tools-version for GitHub action

mmarkiv committed 7 months ago
Verified
06ccabc0a7b550e06fac79ebb33157b71d8af678

Create swift.yml

mmarkiv committed 7 months ago
Unverified
b9e32e01ac52ec7f0b9cd4d2b4ec9c0f5323c381

Update README

mmarkiv committed 7 months ago

README

The README file for this repository.

SwiftUI Unscreenshottable 📵

Protect sensitive content on iOS.

Unscreenshottable can protect your view from:

1. Screenshots

Hide your view during a screenshot, optionally replacing it with another view.

[!CAUTION] Unscreenshottable's screenshot protection relies on internal, undocumented iOS view hierarchy. It may be safe to
submit to the App Store, but may stop working in future iOS versions – if Apple changes the view hierarchy. The library includes a unit test that checks for the availability of the required internal view.

2. Screen Sharing

Hide your view while the screen is being shared, for example via AirPlay.

3. Inactivity

Hide your view while your app is inactive, for example during task switching.

[!NOTE] You can also protect views with the .privacySensitive() modifier available since iOS 15, but Unscreenshottable allows you to replace your content with another view and supports iOS 14.

Usage

You can apply the protected modifier to your top-level view, typically ContentView:

import SwiftUI
import Unscreenshottable

@main
struct UnscreenshottableDemoApp: App {
    var body: some Scene {
        WindowGroup {
            ContentView()
                .protected {
                    Text("No screenshots nor screen sharing, please.")
                }
        }
    }
}

Protection Options

The .protected modifier can take an optional parameter if you want to limit the protection types (the default is all three). You can even combine multiple protections:

ContentView()
    .protected(from: inactivity) {
        Image("logo")
    }
    .protected(from: [.screenshots, .screenSharing]) {
        Text("No screenshots nor screen sharing, please.")
    }

Installation

Swift Package Manager

Use the package URL or search for the SwiftUI-Unscreenshottable package: https://github.com/markiv/SwiftUI-Unscreenshottable.git.

For how to integrate package dependencies refer to the Adding Package Dependencies to Your App documentation.