From f0f5f6804ccb747693f927bbf950a7b562b4a547 Mon Sep 17 00:00:00 2001 From: Zaphod Beeblebrox Date: Wed, 1 May 2024 21:05:59 +0200 Subject: [PATCH] Patch 0.9.2 feat: - Added Cocoapods distribution docs: - Added library documentation - Added license details --- LICENSE | 21 +++++++++++++ MijickCameraView.podspec | 19 ++++++++++++ .../Config/Public+MCameraController.swift | 31 +++++++++++++++++++ 3 files changed, 71 insertions(+) create mode 100644 LICENSE create mode 100644 MijickCameraView.podspec diff --git a/LICENSE b/LICENSE new file mode 100644 index 000000000..ec8649056 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Mijick + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/MijickCameraView.podspec b/MijickCameraView.podspec new file mode 100644 index 000000000..b14ed5d0c --- /dev/null +++ b/MijickCameraView.podspec @@ -0,0 +1,19 @@ +Pod::Spec.new do |s| + s.name = 'MijickCameraView' + s.summary = 'Camera made simple' + s.description = <<-DESC + CameraView is a free and open-source library dedicated for SwiftUI that allows you to create fully customisable camera view in no time. Keep your code clean. + DESC + + s.version = '1.0.0' + s.ios.deployment_target = '14.0' + s.swift_version = '5.10' + + s.source_files = 'Sources/**/*' + s.frameworks = 'SwiftUI', 'Foundation', 'AVKit', 'AVFoundation', 'MijickTimer' + + s.homepage = 'https://github.com/Mijick/CameraView.git' + s.license = { :type => 'MIT', :file => 'LICENSE' } + s.author = { 'Tomasz Kurylik' => 'tomasz.kurylik@mijick.com' } + s.source = { :git => 'https://github.com/Mijick/CameraView.git', :tag => s.version.to_s } +end diff --git a/Sources/Public/Config/Public+MCameraController.swift b/Sources/Public/Config/Public+MCameraController.swift index 1b0397a0e..ff70e3775 100644 --- a/Sources/Public/Config/Public+MCameraController.swift +++ b/Sources/Public/Config/Public+MCameraController.swift @@ -13,27 +13,58 @@ import SwiftUI // MARK: - Initial Camera Settings public extension MCameraController { + /// Changes the initial setting of Camera Output Type func outputType(_ type: CameraOutputType) -> Self { setAndReturnSelf { $0.cameraManager.change(outputType: type) } } + + /// Changes the initial setting of Camera Position func cameraPosition(_ position: CameraPosition) -> Self { setAndReturnSelf { $0.cameraManager.change(cameraPosition: position) } } + + /// Changes the initial setting of Camera Flash Mode func flashMode(_ flashMode: CameraFlashMode) -> Self { setAndReturnSelf { $0.cameraManager.change(flashMode: flashMode) } } + + /// Changes the initial setting of Camera Grid View Visibility func gridVisible(_ visible: Bool) -> Self { setAndReturnSelf { $0.cameraManager.change(isGridVisible: visible) } } + + /// Changes the Focus Image that is displayed when the camera screen is tapped func focusImage(_ focusImage: UIImage) -> Self { setAndReturnSelf { $0.cameraManager.change(focusImage: focusImage) } } + + /// Changes the color of Focus Image that is displayed when the camera screen is tapped func focusImageColor(_ color: UIColor) -> Self { setAndReturnSelf { $0.cameraManager.change(focusImageColor: color) } } + + /// Changes the size of Focus Image that is displayed when the camera screen is tapped func focusImageSize(_ size: CGFloat) -> Self { setAndReturnSelf { $0.cameraManager.change(focusImageSize: size) } } + + /// Locks the camera interface in portrait orientation (even if device screen rotation is enabled). + /// For more information, see the project documentation (https://github.com/Mijick/CameraView) func lockOrientation(_ appDelegate: MApplicationDelegate.Type) -> Self { setAndReturnSelf { $0.config.appDelegate = appDelegate; $0.cameraManager.lockOrientation() } } } // MARK: - Changing Default Views public extension MCameraController { + /// Replaces the default Camera Screen with a new one of your choice (pass the initialiser as an argument of this method). + /// For more information, see the project documentation (https://github.com/Mijick/CameraView) func cameraScreen(_ builder: @escaping CameraViewBuilder) -> Self { setAndReturnSelf { $0.config.cameraView = builder } } + + /// Replaces the default Media Preview Screen with a new one of your choice (pass the initialiser as an argument of this method). + /// For more information, see the project documentation (https://github.com/Mijick/CameraView) func mediaPreviewScreen(_ builder: PreviewViewBuilder?) -> Self { setAndReturnSelf { $0.config.mediaPreviewView = builder } } + + /// Replaces the default Error Screen with a new one of your choice (pass the initialiser as an argument of this method). + /// For more information, see the project documentation (https://github.com/Mijick/CameraView) func errorScreen(_ builder: @escaping ErrorViewBuilder) -> Self { setAndReturnSelf { $0.config.cameraErrorView = builder } } } // MARK: - Actions public extension MCameraController { + /// Sets the action to be triggered when the photo is taken. Passes the captured content as an argument func onImageCaptured(_ action: @escaping (Data) -> ()) -> Self { setAndReturnSelf { $0.config.onImageCaptured = action } } + + /// Sets the action to be triggered when the video is taken. Passes the captured content as an argument func onVideoCaptured(_ action: @escaping (URL) -> ()) -> Self { setAndReturnSelf { $0.config.onVideoCaptured = action } } + + /// Sets the action triggered when a photo or video is taken func afterMediaCaptured(_ action: @escaping () -> ()) -> Self { setAndReturnSelf { $0.config.afterMediaCaptured = action } } + + /// Determines what happens when the Camera Controller should be closed func onCloseController(_ action: @escaping () -> ()) -> Self { setAndReturnSelf { $0.config.onCloseController = action } } }