Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yonat/CameraBackground
Show camera layer as a background to any UIView
https://github.com/yonat/CameraBackground
camera swift uiview
Last synced: 3 months ago
JSON representation
Show camera layer as a background to any UIView
- Host: GitHub
- URL: https://github.com/yonat/CameraBackground
- Owner: yonat
- License: mit
- Created: 2015-12-09T15:10:12.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2024-04-29T17:47:30.000Z (6 months ago)
- Last Synced: 2024-07-23T07:09:36.336Z (3 months ago)
- Topics: camera, swift, uiview
- Language: Swift
- Size: 321 KB
- Stars: 64
- Watchers: 2
- Forks: 9
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE.txt
Awesome Lists containing this project
- awesome-ios - CameraBackground - Show camera layer as a background to any UIView. (Hardware / Camera)
- awesome-swift - CameraBackground - Show camera layer as a background to any UIView. (Libs / Hardware)
- awesome-swift - CameraBackground - Show camera layer as a background to any UIView. (Libs / Hardware)
- awesome-ios-star - CameraBackground - Show camera layer as a background to any UIView. (Hardware / Camera)
- fucking-awesome-swift - CameraBackground - Show camera layer as a background to any UIView. (Libs / Hardware)
- awesome-swift - CameraBackground - Show camera layer as a background to any UIView ` 📝 5 months ago` (Hardware [🔝](#readme))
README
# UIView+CameraBackground
Show camera layer as a background to any UIView.[![Swift Version][swift-image]][swift-url]
[![Build Status][travis-image]][travis-url]
[![License][license-image]][license-url]
[![CocoaPods Compatible](https://img.shields.io/cocoapods/v/CameraBackground.svg)](https://img.shields.io/cocoapods/v/CameraBackground.svg)
[![Platform](https://img.shields.io/cocoapods/p/CameraBackground.svg?style=flat)](http://cocoapods.org/pods/CameraBackground)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)## Features
* Both **front and back** camera supported.
* **Flash** modes: auto, on, off.
* Countdown **timer**.
* Tap to **focus**.
* Pinch to **zoom**.
## Usage
```swift
view.addCameraBackground()
// ...
view.takeCameraSnapshot( {
// animate snapshot capture
self.view.alpha = 0
UIView.animate(withDuration: 1) { self.view.alpha = 1 }
},
completion: { (capturedImage, error) -> () in
self.view.freeCameraSnapshot() // unfreeze image
// ... handle capturedImage and error
}
)
// ...
view.removeCameraBackground()
```**Important:** Remember to add `NSCameraUsageDescription` to your `Info.plist`.
### Layout
You can change the location of the camera controls (flash, timer, and front/back camera selection) or hide them altogether:
```swift
view.addCameraBackground(
showButtons: true,
buttonMargins: UIEdgeInsets(top: 30, left: 10, bottom: 10, right: 10),
buttonsLocation: .left
)
```## Installation
### CocoaPods:
```ruby
pod 'CameraBackground'
```Legacy versions:
| Swift version | CameraBackground version |
| :---: | :--- |
| 4.0 (Xcode 9.4) | `pod 'MiniLayout', '~> 1.2.1'`
`pod 'MultiToggleButton', '~> 1.7.1'`
`pod 'CameraBackground', '~> 1.4.1'` |
| 3 | `pod 'MiniLayout', '~> 1.1.0'`
`pod 'MultiToggleButton', '~> 1.5.2'`
`pod 'CameraBackground', '~> 1.2'` |
| 2.3 | `pod 'MiniLayout', '~> 1.0.1'`
`pod 'MultiToggleButton', '~> 1.4.0'`
`pod 'CameraBackground', '~> 1.0.2'` |### Swift Package Manager:
```swift
dependencies: [
.package(url: "https://github.com/yonat/CameraBackground", from: "1.7.1")
]
```## Meta
[@yonatsharon](https://twitter.com/yonatsharon)
[https://github.com/yonat/CameraBackground](https://github.com/yonat/CameraBackground)
[swift-image]:https://img.shields.io/badge/swift-5.0-orange.svg
[swift-url]: https://swift.org/
[license-image]: https://img.shields.io/badge/License-MIT-blue.svg
[license-url]: LICENSE.txt
[travis-image]: https://img.shields.io/travis/dbader/node-datadog-metrics/master.svg?style=flat-square
[travis-url]: https://travis-ci.org/dbader/node-datadog-metrics
[codebeat-image]: https://codebeat.co/badges/c19b47ea-2f9d-45df-8458-b2d952fe9dad
[codebeat-url]: https://codebeat.co/projects/github-com-vsouza-awesomeios-com