Skip to content
This repository was archived by the owner on Jul 1, 2022. It is now read-only.

Commit aee4a64

Browse files
Updated readme
1 parent 7b9c516 commit aee4a64

File tree

1 file changed

+32
-4
lines changed

1 file changed

+32
-4
lines changed

README.md

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,45 @@ Add `import ALCameraViewController` to the top of you controller file.
4242
In the viewController
4343
```swift
4444

45-
let croppingEnabled = true
46-
let cameraViewController = CameraViewController(croppingEnabled: croppingEnabled) { [weak self] image, asset in
45+
let cameraViewController = CameraViewController { [weak self] image, asset in
4746
// Do something with your image here.
48-
// If cropping is enabled this image will be the cropped version
49-
5047
self?.dismiss(animated: true, completion: nil)
5148
}
5249

5350
present(cameraViewController, animated: true, completion: nil)
5451
```
5552

53+
### Parameters
54+
55+
There are a number of configurable options available for `CameraViewController`
56+
57+
```swift
58+
init(croppingParameters: CroppingParameters = CroppingParameters(),
59+
allowsLibraryAccess: Bool = true,
60+
allowsSwapCameraOrientation: Bool = true,
61+
allowVolumeButtonCapture: Bool = true,
62+
completion: @escaping CameraViewCompletion)
63+
```
64+
65+
The Cropping Parameters struct accepts the following parameters
66+
67+
```swift
68+
init(isEnabled: Bool = false,
69+
allowResizing: Bool = true,
70+
allowMoving: Bool = true,
71+
minimumSize: CGSize = CGSize(width: 60, height: 60))
72+
```
73+
74+
The success parameter returns a `UIImage?` and a `PHAsset?` for more advanced use cases.
75+
If the user canceled photo capture ten both of these options will be `nil`
76+
77+
```swift
78+
typealias CameraViewCompletion = (UIImage?, PHAsset?) -> Void
79+
```
80+
> Note: To prevent retain cycles, it is best to use a `[weak self]` reference within the success parameter
81+
82+
### Other usage options
83+
5684
You can also instantiate the image picker component by itself as well.
5785
```swift
5886

0 commit comments

Comments
 (0)