Skip to content

Commit 05a66bc

Browse files
author
Ricardo Torrão
committed
4.4.0
1 parent eec63a8 commit 05a66bc

3 files changed

Lines changed: 40 additions & 13 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
All notable changes to this project will be documented in this file.
33
This project adheres to [Semantic Versioning](http://semver.org/).
44

5+
## [4.4.0](https://github.com/imaginary-cloud/CameraManager/tree/4.4.0) - 2019-03-12
6+
### Changed
7+
- Change callbacks to the swifty way of reporting success and errors (pull request #185)
8+
59
## [4.3.1](https://github.com/imaginary-cloud/CameraManager/tree/4.3.1) - 2019-03-08
610
### Fixed
711

CameraManager.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
Pod::Spec.new do |s|
22
s.name = "CameraManager"
3-
s.version = "4.3.1"
3+
s.version = "4.4.0"
44
s.summary = "This is a simple Swift class to provide all the configurations you need to create custom camera view in your app. Just drag, drop and use."
55
s.requires_arc = true
66
s.homepage = "https://github.com/imaginary-cloud/CameraManager"
77
s.license = 'MIT'
88
s.author = { "torrao" => "rtorrao@imaginarycloud.com" }
9-
s.source = { :git => "https://github.com/imaginary-cloud/CameraManager.git", :tag => "4.3.1" }
9+
s.source = { :git => "https://github.com/imaginary-cloud/CameraManager.git", :tag => "4.4.0" }
1010
s.social_media_url = 'http://www.imaginarycloud.com/'
1111
s.platform = :ios, '9.0'
1212
s.pod_target_xcconfig = { "SWIFT_VERSION" => "4.2" }

README.md

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
21
# Camera Manager
2+
33
[![CocoaPods](https://img.shields.io/cocoapods/v/CameraManager.svg)](https://github.com/imaginary-cloud/CameraManager) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
44

55
This is a simple Swift class to provide all the configurations you need to create custom camera view in your app.
@@ -15,8 +15,8 @@ The easiest way to install the CameraManager is with [CocoaPods](http://cocoapod
1515
```ruby
1616
use_frameworks!
1717

18-
pod 'CameraManager', '~> 4.3'
19-
```
18+
pod 'CameraManager', '~> 4.4'
19+
```
2020

2121
## Installation with Swift Package Manager
2222

@@ -41,27 +41,36 @@ let package = Package(
4141
Add the following line to your Cartfile:
4242

4343
```
44-
github "imaginary-cloud/CameraManager" >= 4.3
44+
github "imaginary-cloud/CameraManager" >= 4.4
4545
```
4646

4747
And run `carthage update` to build the dynamic framework.
4848

4949
## How to use
50+
5051
To use it you just add the preview layer to your desired view, you'll get back the state of the camera if it's unavailable, ready or the user denied access to it. Have in mind that in order to retain the AVCaptureSession you will need to retain cameraManager instance somewhere, ex. as an instance constant.
52+
5153
```swift
5254
let cameraManager = CameraManager()
5355
cameraManager.addPreviewLayerToView(self.cameraView)
5456

5557
```
5658

5759
To shoot image all you need to do is call:
60+
5861
```swift
59-
cameraManager.capturePictureWithCompletion({ (image, error) -> Void in
60-
self.myImage = image
62+
cameraManager.capturePictureWithCompletion({ result in
63+
switch result {
64+
case .failure:
65+
// error handling
66+
case .success(let content):
67+
self.myImage = content.asImage;
68+
}
6169
})
6270
```
6371

6472
To record video you call:
73+
6574
```swift
6675
cameraManager.startRecordingVideo()
6776
cameraManager.stopVideoRecording({ (videoURL, recordError) -> Void in
@@ -78,6 +87,7 @@ cameraManager.stopVideoRecording({ (videoURL, recordError) -> Void in
7887
```
7988

8089
To zoom in manually:
90+
8191
```swift
8292
let zoomScale = CGFloat(2.0)
8393
cameraManager.zoom(zoomScale)
@@ -86,6 +96,7 @@ cameraManager.zoom(zoomScale)
8696
### Properties
8797

8898
You can set input device to front or back camera. `(Default: .Back)`
99+
89100
```swift
90101
cameraManager.cameraDevice = .front || .back
91102
```
@@ -111,69 +122,82 @@ cameraManager.cameraOutputMode = .stillImage || .videoWithMic || .videoOnly
111122
```
112123

113124
You can set the quality. `(Default: .high)`
125+
114126
```swift
115127
cameraManager.cameraOutputQuality = .low || .medium || .high
116128
```
117129

118130
You can specify the focus mode. `(Default: .continuousAutoFocus)`
131+
119132
```swift
120133
cameraManager.focusMode = .autoFocus || .continuousAutoFocus || .locked
121134
```
122135

123136
You can specifiy the exposure mode. `(Default: .continuousAutoExposure)`
137+
124138
```swift
125139
cameraManager.exposureMode = .autoExpose || .continuousAutoExposure || .locked || .custom
126140
```
127141

128142
You can change the flash mode (it will also set corresponding flash mode). `(Default: .off)`
143+
129144
```swift
130145
cameraManager.flashMode = .off || .on || .auto
131146
```
132147

133148
You can specify the stabilisation mode to be used during a video record session. `(Default: .auto)`
149+
134150
```swift
135151
cameraManager.videoStabilisationMode = .auto || .cinematic
136152
```
137153

138154
You can enable location services for storing in Camera Roll. `(Default: false)`
155+
139156
```swift
140157
cameraManager.shouldUseLocationServices = true || false
141158
```
142159

143160
You can specify if you want to save the files to phone library. `(Default: true)`
161+
144162
```swift
145163
cameraManager.writeFilesToPhoneLibrary = true || false
146164
```
147165

148166
You can specify the album names for image and video recordings.
149-
```swift
150-
cameraManager.imageAlbumName = "Image Album Name"
151-
cameraManager.videoAlbumName = "Video Album Name"
167+
168+
```swift
169+
cameraManager.imageAlbumName = "Image Album Name"
170+
cameraManager.videoAlbumName = "Video Album Name"
152171
```
153172

154173
You can specify if you want to disable animations. `(Default: true)`
174+
155175
```swift
156176
cameraManager.animateShutter = true || false
157177
cameraManager.animateCameraDeviceChange = true || false
158178
```
159179

160180
You can specify if you want the user to be asked about camera permissions automatically when you first try to use the camera or manually. `(Default: true)`
181+
161182
```swift
162183
cameraManager.showAccessPermissionPopupAutomatically = true || false
163184
```
164185

165186
To check if the device supports flash call:
187+
166188
```swift
167189
cameraManager.hasFlash
168190
```
169191

170192
To change flash mode to the next available one you can use this handy function which will also return current value for you to update the UI accordingly:
193+
171194
```swift
172195
cameraManager.changeFlashMode()
173196
```
174197

175198
You can even setUp your custom block to handle error messages:
176199
It can be customized to be presented on the Window root view controller, for example.
200+
177201
```swift
178202
cameraManager.showErrorBlock = { (erTitle: String, erMessage: String) -> Void in
179203
var alertController = UIAlertController(title: erTitle, message: erMessage, preferredStyle: .alert)
@@ -195,10 +219,9 @@ cameraManager.showErrorBlock = { (erTitle: String, erMessage: String) -> Void in
195219

196220
Supports iOS 9 and above. Xcode 10.0 is required to build the latest code written in Swift 4.2.
197221

198-
199222
Now it's compatible with latest Swift syntax, so if you're using any Swift version prior to 4.2 make sure to use one of the previously tagged releases:
200223

201-
- for Swift 4.0 see: [v4.3.0](https://github.com/imaginary-cloud/CameraManager/tree/4.3.0))
224+
- for Swift 4.0 see: [v4.4.0](https://github.com/imaginary-cloud/CameraManager/tree/4.4.0))
202225

203226
- for Swift 3.0 see: [v3.2.0](https://github.com/imaginary-cloud/CameraManager/tree/3.2.0)).
204227

0 commit comments

Comments
 (0)