Giter VIP home page Giter VIP logo

rxscreenprotectkit's Introduction

Miss Electric Eel 2016 RxScreenProtectKit

RxScreenProtectKit ios MIT Carthage compatible Build Status codecov

Protect private content from screen recordings and screen output.
Screen Recording / QuickTime Recording / External display output / AirPlay

Installation

CocoaPods

# Podfile
use_frameworks!

target 'YOUR_TARGET_NAME' do
    pod 'RxScreenProtectKit'
end

Replace YOUR_TARGET_NAME and then, in the Podfile directory, type:

$ pod install

Carthage

Add this to Cartfile.

# Cartfile
github "AkkeyLab/RxScreenProtectKit"

Run this script to install it.

$ carthage update --platform iOS

Usage

If you use the example, please do the setup process with the shell script.

./setup.sh

Please import RxScreenProtectKit and RxSwift.

import RxScreenProtectKit
import RxSwift
import UIKit

By binding the target layer to isScreenRecord, mosaic processing is applied during screen recording or screen output. However, the layer must be compliant with CALayer.

final class ViewController: UIViewController {
    @IBOutlet private weak var mainImageView: UIImageView!
    private let bag = DisposeBag()

    override func viewDidLoad() {
        super.viewDidLoad()
        self.rx.isScreenRecord
            .bind(to: mainImageView.layer.rx.isMosaic)
            .disposed(by: bag)
    }
}

Parameter settings related to mosaic processing can be done from ScreenProtectKit.shared.config().

ScreenProtectKit
    .shared
    .config(rasterizationScale: 0.1,
            minificationFilter: .trilinear,
            magnificationFilter: .nearest)

Moreover, it can be easily implemented by using SPImageView. This is particularly useful when images are set asynchronously.

final class ViewController: UIViewController {
    @IBOutlet private weak var mainImageView: SPImageView!

    override func viewDidLoad() {
        super.viewDidLoad()
        DispatchQueue.main.asyncAfter(deadline: .now() + 5) { [weak self] in
            self?.mainImageView.image = UIImage(named: "sample")
        }
    }
}

Also, by using SPLabel, you can easily implement character substitution during recording. All you need to do is set the text to be displayed during recording in protectText.

final class ViewController: UIViewController {
    @IBOutlet private weak var label: SPLabel!

    override func viewDidLoad() {
        super.viewDidLoad()
        label.text = "This is the original text."
        label.protectText = "Recording is prohibited!!"
    }
}

Settings

You can temporarily disable this feature. In addition, it returns to the valid state by restarting the app.
isScreenRecord will not flow while this setting is disabled.
When the value of this setting is changed, isScreenRecord will flow only once. When changed to invalid, false will flow, and when changed to valid, the current recording status will flow.

ScreenProtectKit
    .shared
    .isValid = isValid

Requirements

env version
Swift 5.x
Xcode 11.x
iOS 11.0

License

RxScreenProtectKit is available under the MIT license. See the LICENSE file for more info.

rxscreenprotectkit's People

Contributors

akkeylab avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

rxscreenprotectkit's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.