@@ -13,27 +13,58 @@ import SwiftUI
13
13
14
14
// MARK: - Initial Camera Settings
15
15
public extension MCameraController {
16
+ /// Changes the initial setting of Camera Output Type
16
17
func outputType( _ type: CameraOutputType ) -> Self { setAndReturnSelf { $0. cameraManager. change ( outputType: type) } }
18
+
19
+ /// Changes the initial setting of Camera Position
17
20
func cameraPosition( _ position: CameraPosition ) -> Self { setAndReturnSelf { $0. cameraManager. change ( cameraPosition: position) } }
21
+
22
+ /// Changes the initial setting of Camera Flash Mode
18
23
func flashMode( _ flashMode: CameraFlashMode ) -> Self { setAndReturnSelf { $0. cameraManager. change ( flashMode: flashMode) } }
24
+
25
+ /// Changes the initial setting of Camera Grid View Visibility
19
26
func gridVisible( _ visible: Bool ) -> Self { setAndReturnSelf { $0. cameraManager. change ( isGridVisible: visible) } }
27
+
28
+ /// Changes the Focus Image that is displayed when the camera screen is tapped
20
29
func focusImage( _ focusImage: UIImage ) -> Self { setAndReturnSelf { $0. cameraManager. change ( focusImage: focusImage) } }
30
+
31
+ /// Changes the color of Focus Image that is displayed when the camera screen is tapped
21
32
func focusImageColor( _ color: UIColor ) -> Self { setAndReturnSelf { $0. cameraManager. change ( focusImageColor: color) } }
33
+
34
+ /// Changes the size of Focus Image that is displayed when the camera screen is tapped
22
35
func focusImageSize( _ size: CGFloat ) -> Self { setAndReturnSelf { $0. cameraManager. change ( focusImageSize: size) } }
36
+
37
+ /// Locks the camera interface in portrait orientation (even if device screen rotation is enabled).
38
+ /// For more information, see the project documentation (https://github.com/Mijick/CameraView)
23
39
func lockOrientation( _ appDelegate: MApplicationDelegate . Type ) -> Self { setAndReturnSelf { $0. config. appDelegate = appDelegate; $0. cameraManager. lockOrientation ( ) } }
24
40
}
25
41
26
42
// MARK: - Changing Default Views
27
43
public extension MCameraController {
44
+ /// Replaces the default Camera Screen with a new one of your choice (pass the initialiser as an argument of this method).
45
+ /// For more information, see the project documentation (https://github.com/Mijick/CameraView)
28
46
func cameraScreen( _ builder: @escaping CameraViewBuilder ) -> Self { setAndReturnSelf { $0. config. cameraView = builder } }
47
+
48
+ /// Replaces the default Media Preview Screen with a new one of your choice (pass the initialiser as an argument of this method).
49
+ /// For more information, see the project documentation (https://github.com/Mijick/CameraView)
29
50
func mediaPreviewScreen( _ builder: PreviewViewBuilder ? ) -> Self { setAndReturnSelf { $0. config. mediaPreviewView = builder } }
51
+
52
+ /// Replaces the default Error Screen with a new one of your choice (pass the initialiser as an argument of this method).
53
+ /// For more information, see the project documentation (https://github.com/Mijick/CameraView)
30
54
func errorScreen( _ builder: @escaping ErrorViewBuilder ) -> Self { setAndReturnSelf { $0. config. cameraErrorView = builder } }
31
55
}
32
56
33
57
// MARK: - Actions
34
58
public extension MCameraController {
59
+ /// Sets the action to be triggered when the photo is taken. Passes the captured content as an argument
35
60
func onImageCaptured( _ action: @escaping ( Data ) -> ( ) ) -> Self { setAndReturnSelf { $0. config. onImageCaptured = action } }
61
+
62
+ /// Sets the action to be triggered when the video is taken. Passes the captured content as an argument
36
63
func onVideoCaptured( _ action: @escaping ( URL ) -> ( ) ) -> Self { setAndReturnSelf { $0. config. onVideoCaptured = action } }
64
+
65
+ /// Sets the action triggered when a photo or video is taken
37
66
func afterMediaCaptured( _ action: @escaping ( ) -> ( ) ) -> Self { setAndReturnSelf { $0. config. afterMediaCaptured = action } }
67
+
68
+ /// Determines what happens when the Camera Controller should be closed
38
69
func onCloseController( _ action: @escaping ( ) -> ( ) ) -> Self { setAndReturnSelf { $0. config. onCloseController = action } }
39
70
}
0 commit comments