|
| 1 | +<p align="center"> |
| 2 | + <img src="wyler.png" width="650 max-width="90%" alt="Wyler" /> |
| 3 | +</p> |
| 4 | + |
| 5 | +<p align="center"> |
| 6 | + <img src="https://img.shields.io/badge/Swift-5.2-orange.svg" /> |
| 7 | + <a href="https://swift.org/package-manager"> |
| 8 | + <img src="https://img.shields.io/badge/spm-compatible-brightgreen.svg?style=flat" alt="Swift Package Manager" /> |
| 9 | + </a> |
| 10 | + <a href="https://github.com/Carthage/Carthage"> |
| 11 | + <img src="https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat" alt="Carthage" /> |
| 12 | + </a> |
| 13 | + <a href="https://cocoapods.org"> |
| 14 | + <img src="https://img.shields.io/cocoapods/v/EZSwiftExtensions.svg" alt="CocoaPods" /> |
| 15 | + </a> |
| 16 | + <a href="http://makeapullrequest.com"> |
| 17 | + <img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square" alt="PRs Welcome" /> |
| 18 | + </a> |
| 19 | + <a href="https://medium.com/@toupper"> |
| 20 | + <img src="https://img.shields.io/badge/[email protected]" alt="Medium: @toupper" /> |
| 21 | + </a> |
| 22 | +</p> |
| 23 | + |
| 24 | +Welcome to **Wyler** — A light library written in Swift that makes easy the process of Screen Recording for IOS. You can record your app video screen, access to the recorded video, and save it to the Photo Library. |
| 25 | + |
| 26 | +## Features |
| 27 | + |
| 28 | +- [x] App Screen Recording |
| 29 | +- [x] Set Video Size |
| 30 | +- [x] Access to the Video |
| 31 | +- [x] Save the video to the Photo Library |
| 32 | + |
| 33 | +## Requirements |
| 34 | + |
| 35 | +- iOS 11.0+ |
| 36 | +- Xcode 11.0+ |
| 37 | + |
| 38 | +## Installation |
| 39 | +Since Codextended is implemented within a single file, the easiest way to use it is to simply drag and drop it into your Xcode project. If anyways you want to use a dependency manager: |
| 40 | + |
| 41 | +#### CocoaPods |
| 42 | +You can use [CocoaPods](http://cocoapods.org/) to install `Wyler` by adding it to your `Podfile`: |
| 43 | + |
| 44 | +```ruby |
| 45 | +platform :ios, '11.0' |
| 46 | +use_frameworks! |
| 47 | +pod 'Wyler' |
| 48 | +``` |
| 49 | + |
| 50 | +To get the full benefits import `Wyler` wherever you use it |
| 51 | + |
| 52 | +``` swift |
| 53 | +import Wyler |
| 54 | +``` |
| 55 | +### Carthage |
| 56 | + |
| 57 | +[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. To integrate Alamofire into your Xcode project using Carthage, specify it in your `Cartfile`: |
| 58 | + |
| 59 | +```ogdl |
| 60 | +github "toupper/Wyler" |
| 61 | +``` |
| 62 | + |
| 63 | +### Swift Package Manager |
| 64 | + |
| 65 | +The [Swift Package Manager](https://swift.org/package-manager/) is a tool for automating the distribution of Swift code and is integrated into the `swift` compiler. It is in early development, but Alamofire does support its use on supported platforms. |
| 66 | + |
| 67 | +Once you have your Swift package set up, adding Wyler as a dependency is as easy as adding it to the `dependencies` value of your `Package.swift`. |
| 68 | + |
| 69 | +```swift |
| 70 | +dependencies: [ |
| 71 | + .package(url: "https://github.com/toupper/Wyler.git", .upToNextMajor(from: "0.1.2")) |
| 72 | +] |
| 73 | +``` |
| 74 | +## Manually |
| 75 | + |
| 76 | +You can also integrate Wyler into your project manually. |
| 77 | + |
| 78 | +#### Embedded Framework |
| 79 | + |
| 80 | +- Open up Terminal, `cd` into your top-level project directory, and run the following command "if" your project is not initialized as a git repository: |
| 81 | + |
| 82 | + ```bash |
| 83 | + $ git init |
| 84 | + ``` |
| 85 | + |
| 86 | +- Add Wyler as a git [submodule](https://git-scm.com/docs/git-submodule) by running the following command: |
| 87 | + |
| 88 | + ```bash |
| 89 | + $ git submodule add https://github.com/toupper/Wyler.git |
| 90 | + ``` |
| 91 | + |
| 92 | +- Open the new `Wyler` folder, and drag the `Wyler.xcodeproj` into the Project Navigator of your application's Xcode project. |
| 93 | + |
| 94 | +- And that's it! |
| 95 | + |
| 96 | +## Usage example |
| 97 | + |
| 98 | +### Recording |
| 99 | + |
| 100 | +Import Wyler in the file you are going to use it. Create an instance of ```ScreenRecorder```, and call it to start recording whenever you want: |
| 101 | + |
| 102 | +```swift |
| 103 | +import Wyler |
| 104 | + |
| 105 | +screenRecorder.startRecording(saveToCameraRoll: true, errorHandler: { error in |
| 106 | + debugPrint("Error when recording \(error)") |
| 107 | +}) |
| 108 | +``` |
| 109 | +If you want to access the video or set a different size than the App screen, you can pass these parameters: |
| 110 | + |
| 111 | +```swift |
| 112 | +import Wyler |
| 113 | + |
| 114 | +screenRecorder.startRecording(to: yourInternalURL, |
| 115 | + size: yourSize, |
| 116 | + saveToCameraRoll: true, |
| 117 | + errorHandler: { error in |
| 118 | + debugPrint("Error when recording \(error)") |
| 119 | + }) |
| 120 | +``` |
| 121 | + |
| 122 | + |
| 123 | +When you want to stop recording, you just have to call the recorder with stop recording: |
| 124 | + |
| 125 | +```swift |
| 126 | +import Wyler |
| 127 | + |
| 128 | +screenRecorder.stoprecording(errorHandler: { error in |
| 129 | + debugPrint("Error when stop recording \(error)") |
| 130 | +}) |
| 131 | +``` |
| 132 | +If you want to save the video to the camera, do not forget to add the Privacy - Photo Library Usage Description to the Info.plist |
| 133 | +## Contribute |
| 134 | + |
| 135 | +We would love you for the contribution to **Wyler**, check the ``LICENSE`` file for more info. |
| 136 | + |
| 137 | +## Credits |
| 138 | + |
| 139 | +Created and maintained with love by [César Vargas Casaseca](https://github.com/toupper). You can follow me on Medium [@toupper](https://medium.com/@toupper) for project updates, releases and more stories. |
| 140 | + |
| 141 | +## License |
| 142 | + |
| 143 | +Wyler is released under the MIT license. [See LICENSE](https://github.com/toupper/Wyler/blob/master/LICENSE) for details. |
0 commit comments