Skip to content

Commit 44644e9

Browse files
committed
Adjust camera documentation
1 parent 8f20afb commit 44644e9

File tree

3 files changed

+50
-57
lines changed

3 files changed

+50
-57
lines changed

Sources/SwiftUIKit/Cameras/DocumentCamera.swift

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,22 @@
1010
import SwiftUI
1111
import VisionKit
1212

13-
/**
14-
This view can be used to open a camera that can scan one or
15-
multiple pages in a physical document.
16-
17-
You create a document camera by providing two action blocks:
18-
19-
```swift
20-
let camera = DocumentCamera(
21-
cancelAction: { print("User did cancel") } // Optional
22-
resultAction: { result in ... } // Mandatory
23-
}
24-
```
25-
26-
You can then present this camera with a sheet, a modal, etc.
27-
28-
The camera uses a `VNDocumentCameraViewController` and will
29-
return a `VNDocumentCameraScan` with all document pages.
30-
*/
13+
/// This view can be used to open a camera that can scan one
14+
/// or multiple pages in a physical document.
15+
///
16+
/// You can create a document camera by defining two actions:
17+
///
18+
/// ```swift
19+
/// let camera = DocumentCamera(
20+
/// cancelAction: { print("User did cancel") } // Optional
21+
/// resultAction: { result in ... } // Mandatory
22+
/// }
23+
/// ```
24+
///
25+
/// You can then present the camera with a sheet, modal, etc.
26+
///
27+
/// This camera uses a `VNDocumentCameraViewController` that
28+
/// will return a `VNDocumentCameraScan` with all scan pages.
3129
public struct DocumentCamera: UIViewControllerRepresentable {
3230

3331
/// Create a document camera.

Sources/SwiftUIKit/Cameras/PhotoCamera.swift

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,21 @@
1010
import Photos
1111
import SwiftUI
1212

13-
/**
14-
This view can be used to open a camera that can take photos.
15-
16-
You create a camera instance by providing two action blocks:
17-
18-
```swift
19-
let picker = Camera(
20-
cancelAction: { print("User did cancel") } // Optional
21-
finishAction: { result in ... }) // Mandatory
22-
}
23-
```
24-
25-
You can then present this camera with a sheet, a modal, etc.
26-
27-
This camera returns a result that contains the picked image,
28-
which you then can use in any way you want.
29-
*/
13+
/// This view can be used to open a regular photo camera.
14+
///
15+
/// You can create a camera instance by defining two actions:
16+
///
17+
/// ```swift
18+
/// let picker = PhotoCamera(
19+
/// cancelAction: { print("User did cancel") } // Optional
20+
/// finishAction: { result in ... }) // Mandatory
21+
/// }
22+
/// ```
23+
///
24+
/// You can then present the camera with a sheet, modal, etc.
25+
///
26+
/// The camera returns a result with the picked image, which
27+
/// you can then use in any way you want.
3028
public struct PhotoCamera: View {
3129

3230
/// Create a photo camera.

Sources/SwiftUIKit/Pickers/ImagePicker.swift

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,25 @@ import Photos
1111
import SwiftUI
1212
import UIKit
1313

14-
/**
15-
This picker can be used to pick photos from Photos, using a
16-
camera to take a photo, etc.
17-
18-
The view wraps a `UIImagePickerController` and makes itself
19-
the delegate.
20-
21-
You can create a picker instance by providing a source type,
22-
as well as action blocks that are triggered when picking or
23-
cancelling the picker operation:
24-
25-
```swift
26-
let picker = ImagePicker(
27-
sourceType: .camera,
28-
cancelAction: { print("User did cancel") } // Optional
29-
resultAction: { result in ... }) // Mandatory
30-
}
31-
```
32-
33-
The picker result contains the picked image, which you then
34-
can use in any way you want.
35-
*/
14+
/// This picker can be used to pick photos from Photos, pick
15+
/// a photo with the camera, etc.
16+
///
17+
/// The view wraps a `UIImagePickerController` and registers
18+
/// itself as the picker delegate.
19+
///
20+
/// You can create an image picker instance by providing the
21+
/// picker source type, plus actions that are triggered when
22+
/// picking or cancelling the picker operation:
23+
///
24+
/// ```swift
25+
/// let picker = ImagePicker(
26+
/// sourceType: .camera,
27+
/// cancelAction: { print("User did cancel") } // Optional
28+
/// resultAction: { result in ... }) // Mandatory
29+
/// }
30+
/// ```
31+
/// The picker returns a result with the picked image, which
32+
/// you can then use in any way you want.
3633
public struct ImagePicker: UIViewControllerRepresentable {
3734

3835
/// Create an image picker.

0 commit comments

Comments
 (0)