diff --git a/Example/Pods/Pods.xcodeproj/project.pbxproj b/Example/Pods/Pods.xcodeproj/project.pbxproj index f8917f0..b0c3624 100644 --- a/Example/Pods/Pods.xcodeproj/project.pbxproj +++ b/Example/Pods/Pods.xcodeproj/project.pbxproj @@ -176,7 +176,6 @@ 66765C285B32C678C2781CD8500D0556 /* ScreenCaptureDetector */ = { isa = PBXGroup; children = ( - 8442B4282455A58D002237D6 /* Media */, 84E128D92452273200F5ACEF /* Source */, 58B765451A458678FE9405C8D115C008 /* Pod */, 38290A6B2E2FB11E2C48793206B0A4AD /* Support Files */, @@ -185,14 +184,6 @@ path = ../..; sourceTree = ""; }; - 8442B4282455A58D002237D6 /* Media */ = { - isa = PBXGroup; - children = ( - ); - name = Media; - path = Example/ScreenCaptureDetector/Media; - sourceTree = ""; - }; 84E128D92452273200F5ACEF /* Source */ = { isa = PBXGroup; children = ( diff --git a/README.md b/README.md index 300cead..5e14299 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ ## Picture says a thousand words --- -![Alt text](https://github.com/amrangry/NYTimes/blob/master/project_demo_gif.gif?raw=true "sample") +![Alt text](https://github.com/amrangry/ScreenCaptureDetector/blob/master/Example/ScreenCaptureDetector/Images.xcassets/screendetector.dataset/screendetector.gif?raw=true "Screen Player") ## Example @@ -45,17 +45,50 @@ pod 'ScreenCaptureDetector' ## How To Use -Simply import ScreenBlocker-iOS in AppDelegate: -import ScreenBlocker_iOS +Simply import ScreenCaptureDetector in AppDelegate: +import ScreenCaptureDetector -Add the following to AppDelegate's applicationWillResignActive: -ScreenBlocker.shared.show() -or -ScreenBlocker.shared.show(bgColor: UIColor.someColor) - -Add the following to AppDelegate's applicationDidBecomeActive: -ScreenBlocker.shared.hide() +Add the following to AppDelegate's didFinishLaunchingWithOptions: +```ruby +///How to use using default instance +let monitor = ScreenCaptureRecordingDetector.createDafaultInstnace() +monitor.startMonitor() +``` +Or "Recommended" +```ruby +1- conform protocol ScreenCaptureDelegate that has 3 optional func : + func didStartCapture() + func didEndCapture() + func didTakeScreenshot() + +2- passing the conformed class to the init method of ScreenCaptureRecordingDetector +3- calling method startMonitor() to start +4- calling method endMonitor() to stop + +``` +Or +```ruby + ///How to use using NotificationCenter + let monitor = ScreenCaptureRecordingDetector() + monitor.delegate = nil + monitor.startMonitor() + NotificationCenter.default.addObserver(self, selector: #selector(showScreen), name: .screenCapturingStarted, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(dimissScreen), name: .screenCapturingEnded, object: nil) + +``` +Or +```ruby + ///How to use using Custom view + let appDelegate = UIApplication.shared.delegate as? AppDelegate + let overWindow = appDelegate?.window + let customView = UIView.init(frame: overWindow?.bounds ?? CGRect.init(x: 0, y: 0, width: 200, height: 200)) + customView.backgroundColor = .yellow + + let screenCaptureDelegate = ScreenCaptureDelegateDefaultImpl(suspendView: customView, drawOver: overWindow) + let monitor = ScreenCaptureRecordingDetector(delegate: screenCaptureDelegate) + monitor.startMonitor() +``` ## Environment --- ```ruby