Updated README

This commit is contained in:
Andrew Walz 2017-08-25 14:51:17 -06:00
parent fa6e301806
commit a94043d5ac

View file

@ -1,4 +1,4 @@
<img src="SwiftyCamBanner.jpg" align="center"> <img src="SwiftyCamBanner.jpg" align="center">
<p align="center"> <p align="center">
<img src="https://img.shields.io/badge/platform-iOS%208%2B-blue.svg?style=flat" alt="Platform: iOS 8+"/> <img src="https://img.shields.io/badge/platform-iOS%208%2B-blue.svg?style=flat" alt="Platform: iOS 8+"/>
@ -13,10 +13,12 @@ SwiftyCam is a a simple, Snapchat-style iOS Camera framework for easy photo and
Configuring a Camera View Controller in AVFoundation can be tedious and time consuming. SwiftyCam is a drop in View Controller which gives complete control of the AVSession. Configuring a Camera View Controller in AVFoundation can be tedious and time consuming. SwiftyCam is a drop in View Controller which gives complete control of the AVSession.
### For Swift 4 support, see Swift4 branch
## Features ## Features
| | SwiftyCam | | SwiftyCam
| ------------------------------------- | --------------------- | ------------------------------------- | ---------------------
| :sunglasses: | Snapchat-style media capture | :sunglasses: | Snapchat-style media capture
| :+1: | Support iOS8+ | :+1: | Support iOS8+
| :camera: | Image capture | :camera: | Image capture
@ -29,7 +31,7 @@ Configuring a Camera View Controller in AVFoundation can be tedious and time con
| :lock: | Supports manual focus | :lock: | Supports manual focus
| :last_quarter_moon_with_face: | Low light setting | :last_quarter_moon_with_face: | Low light setting
| :speaker: | Background audio support | :speaker: | Background audio support
## Requirements ## Requirements
@ -127,13 +129,13 @@ Capturing Video is just as easy. To begin recording video, call the `startVideoR
```swift ```swift
startVideoRecording() startVideoRecording()
``` ```
To end the capture of a video, call the `stopVideoRecording` function: To end the capture of a video, call the `stopVideoRecording` function:
```swift ```swift
stopVideoRecording() stopVideoRecording()
``` ```
### Delegate ### Delegate
@ -142,7 +144,7 @@ In order to acquire the photos and videos taken by either the SwiftyCamButton or
```swift ```swift
class MyCameraViewController : SwiftyCamViewController, SwiftyCamViewControllerDelegate { class MyCameraViewController : SwiftyCamViewController, SwiftyCamViewControllerDelegate {
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
cameraDelegate = self cameraDelegate = self
@ -158,34 +160,34 @@ func swiftyCam(_ swiftyCam: SwiftyCamViewController, didTake photo: UIImage) {
// Called when takePhoto() is called or if a SwiftyCamButton initiates a tap gesture // Called when takePhoto() is called or if a SwiftyCamButton initiates a tap gesture
// Returns a UIImage captured from the current session // Returns a UIImage captured from the current session
} }
func swiftyCam(_ swiftyCam: SwiftyCamViewController, didBeginRecordingVideo camera: SwiftyCamViewController.CameraSelection) { func swiftyCam(_ swiftyCam: SwiftyCamViewController, didBeginRecordingVideo camera: SwiftyCamViewController.CameraSelection) {
// Called when startVideoRecording() is called // Called when startVideoRecording() is called
// Called if a SwiftyCamButton begins a long press gesture // Called if a SwiftyCamButton begins a long press gesture
} }
func swiftyCam(_ swiftyCam: SwiftyCamViewController, didFinishRecordingVideo camera: SwiftyCamViewController.CameraSelection) { func swiftyCam(_ swiftyCam: SwiftyCamViewController, didFinishRecordingVideo camera: SwiftyCamViewController.CameraSelection) {
// Called when stopVideoRecording() is called // Called when stopVideoRecording() is called
// Called if a SwiftyCamButton ends a long press gesture // Called if a SwiftyCamButton ends a long press gesture
} }
func swiftyCam(_ swiftyCam: SwiftyCamViewController, didFinishProcessVideoAt url: URL) { func swiftyCam(_ swiftyCam: SwiftyCamViewController, didFinishProcessVideoAt url: URL) {
// Called when stopVideoRecording() is called and the video is finished processing // Called when stopVideoRecording() is called and the video is finished processing
// Returns a URL in the temporary directory where video is stored // Returns a URL in the temporary directory where video is stored
} }
func swiftyCam(_ swiftyCam: SwiftyCamViewController, didFocusAtPoint point: CGPoint) { func swiftyCam(_ swiftyCam: SwiftyCamViewController, didFocusAtPoint point: CGPoint) {
// Called when a user initiates a tap gesture on the preview layer // Called when a user initiates a tap gesture on the preview layer
// Will only be called if tapToFocus = true // Will only be called if tapToFocus = true
// Returns a CGPoint of the tap location on the preview layer // Returns a CGPoint of the tap location on the preview layer
} }
func swiftyCam(_ swiftyCam: SwiftyCamViewController, didChangeZoomLevel zoom: CGFloat) { func swiftyCam(_ swiftyCam: SwiftyCamViewController, didChangeZoomLevel zoom: CGFloat) {
// Called when a user initiates a pinch gesture on the preview layer // Called when a user initiates a pinch gesture on the preview layer
// Will only be called if pinchToZoomn = true // Will only be called if pinchToZoomn = true
// Returns a CGFloat of the current zoom level // Returns a CGFloat of the current zoom level
} }
func swiftyCam(_ swiftyCam: SwiftyCamViewController, didSwitchCameras camera: SwiftyCamViewController.CameraSelection) { func swiftyCam(_ swiftyCam: SwiftyCamViewController, didSwitchCameras camera: SwiftyCamViewController.CameraSelection) {
// Called when user switches between cameras // Called when user switches between cameras
// Returns current camera selection // Returns current camera selection
@ -199,8 +201,8 @@ The flash(torch) can be enabled by changing the `flashEnabled` property:
```swift ```swift
flashEnabled = true flashEnabled = true
``` ```
Flash is now supported for front and rear facing cameras. Flash is now supported for front and rear facing cameras.
### Rear Camera ### Rear Camera
@ -247,7 +249,7 @@ SwiftyCam has several options for configurating the functionality of the capture
Video quality can be set by the **videoQuality** property of SwiftyCamViewController. The choices available correspond to the matching **AVCaptureSessionPreset**: Video quality can be set by the **videoQuality** property of SwiftyCamViewController. The choices available correspond to the matching **AVCaptureSessionPreset**:
| VideoQuality | AVCaptureSessionPreset | VideoQuality | AVCaptureSessionPreset
| ------------------------------------- | --------------------- | ------------------------------------- | ---------------------
| `.high` | **AVCapturePresetHigh** | `.high` | **AVCapturePresetHigh**
| `.medium` | **AVCapturePresetMedium** | `.medium` | **AVCapturePresetMedium**
| `.low` | **AVCapturePresetLow** | `.low` | **AVCapturePresetLow**
@ -258,7 +260,7 @@ Video quality can be set by the **videoQuality** property of SwiftyCamViewContro
| `.resolution3840x2160` | **AVCaptureSessionPreset3840x2160** | `.resolution3840x2160` | **AVCaptureSessionPreset3840x2160**
| `.iframe960x540` | **AVCaptureSessionPresetiFrame960x540** | `.iframe960x540` | **AVCaptureSessionPresetiFrame960x540**
| `.iframe1280x720` | **AVCaptureSessionPresetiFrame1280x720** | `.iframe1280x720` | **AVCaptureSessionPresetiFrame1280x720**
The default value is **.high**. For use with the front-facing camera, **.high** will always be used. The default value is **.high**. For use with the front-facing camera, **.high** will always be used.
@ -292,7 +294,7 @@ By default, ```swipeToZoom``` is enabled. The default gestures zoom in the captu
```swift ```swift
swipeToZoomInverted = true swipeToZoomInverted = true
``` ```
You can also restrict the amount that the rear facing camera can zoom. To do this, use the `maxZoomScale` property: You can also restrict the amount that the rear facing camera can zoom. To do this, use the `maxZoomScale` property:
@ -339,7 +341,7 @@ lowLightBoost = false
## Privacy ## Privacy
When a user firsts launch SwiftyCamViewController, they will be prompted for permission for access to the cameras and microphones. By default, if a user declines access to the hardware, SwiftyCam will provide a prompt to the App privacy settings inside the iOS settings application. When a user firsts launch SwiftyCamViewController, they will be prompted for permission for access to the cameras and microphones. By default, if a user declines access to the hardware, SwiftyCam will provide a prompt to the App privacy settings inside the iOS settings application.
## Miscellaneous ## Miscellaneous