Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch 2.0.0 #31

Merged
merged 54 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
2a54aae
temp fix alert crash
FulcrumOne Jul 4, 2024
e9889bd
test
FulcrumOne Jul 4, 2024
ecc6aa1
1
FulcrumOne Jul 4, 2024
774f745
1
FulcrumOne Jul 4, 2024
10e0827
1
FulcrumOne Jul 4, 2024
b75a8da
1
FulcrumOne Jul 6, 2024
75a42f6
1
FulcrumOne Jul 7, 2024
063d937
1
FulcrumOne Jul 7, 2024
3a68bfc
1
FulcrumOne Jul 7, 2024
71bf2c8
1
FulcrumOne Jul 7, 2024
d4d4f0c
1
FulcrumOne Jul 7, 2024
1fd8cba
1
FulcrumOne Jul 7, 2024
c619aeb
1
FulcrumOne Jul 7, 2024
4655e84
1
FulcrumOne Jul 7, 2024
20076b9
1
FulcrumOne Jul 7, 2024
63e1e65
1
FulcrumOne Jul 7, 2024
a211431
1
FulcrumOne Jul 7, 2024
2b710cb
1
FulcrumOne Jul 7, 2024
a3e420b
1
FulcrumOne Jul 7, 2024
199749e
1
FulcrumOne Jul 7, 2024
da22fb3
1
FulcrumOne Jul 7, 2024
697b088
1
FulcrumOne Jul 7, 2024
6f6fbab
1
FulcrumOne Jul 7, 2024
3cc8e39
1
FulcrumOne Jul 8, 2024
a9a4bd3
1
FulcrumOne Jul 8, 2024
acbda6e
1
FulcrumOne Jul 8, 2024
4319bea
1
FulcrumOne Jul 8, 2024
66dc968
1
FulcrumOne Jul 8, 2024
f1c5b42
1
FulcrumOne Jul 8, 2024
cc84c5c
1
FulcrumOne Jul 8, 2024
e118369
1
FulcrumOne Jul 8, 2024
2fb13ef
1
FulcrumOne Jul 8, 2024
68aa318
1
FulcrumOne Jul 8, 2024
7c012ea
1
FulcrumOne Jul 11, 2024
2014acd
1
FulcrumOne Jul 11, 2024
485e830
1
FulcrumOne Jul 11, 2024
7a97cce
1
FulcrumOne Jul 11, 2024
ba389d0
1
FulcrumOne Jul 11, 2024
4dee45a
1
FulcrumOne Jul 11, 2024
551a72e
1
FulcrumOne Jul 11, 2024
f8c60a6
1
FulcrumOne Jul 11, 2024
6b1b197
1
FulcrumOne Jul 11, 2024
5f347d9
1
FulcrumOne Jul 11, 2024
fde2f50
1
FulcrumOne Jul 11, 2024
04d1d7e
1
FulcrumOne Jul 11, 2024
b441d10
1
FulcrumOne Jul 11, 2024
3e24e46
1
FulcrumOne Jul 11, 2024
8838546
1
FulcrumOne Jul 11, 2024
08aa82c
1
FulcrumOne Jul 11, 2024
a147f76
Merge branch 'main' of https://github.com/Mijick/CameraView into patc…
FulcrumOne Jul 11, 2024
bd6cc15
Update README.md
FulcrumOne Jul 11, 2024
3e25b0d
Update README.md
FulcrumOne Jul 11, 2024
534a482
1
FulcrumOne Jul 12, 2024
8edaf37
Merge branch 'patch-2.0.0' of https://github.com/Mijick/CameraView in…
FulcrumOne Jul 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion MijickCameraView.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Pod::Spec.new do |s|
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.2.0'
s.version = '2.0.0'
s.ios.deployment_target = '14.0'
s.swift_version = '5.10'

Expand Down
76 changes: 39 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,10 @@
</p>

<p align="center">
<img alt="Popup Examples" src="https://github.com/Mijick/Assets/blob/main/CameraView/GIFs/CameraView-1.gif" width="30%"/>
<img alt="Popup Examples" src="https://github.com/Mijick/Assets/blob/main/CameraView/GIFs/CameraView-2.gif" width="30%"/>
<img alt="Popup Examples" src="https://github.com/Mijick/Assets/blob/main/CameraView/GIFs/CameraView-3.gif" width="30%"/>
<img alt="Popup Examples" src="https://github.com/Mijick/Assets/blob/main/CameraView/GIFs/CameraView-1.gif" width="24.5%"/>
<img alt="Popup Examples" src="https://github.com/Mijick/Assets/blob/main/CameraView/GIFs/CameraView-2.gif" width="24.5%"/>
<img alt="Popup Examples" src="https://github.com/Mijick/Assets/blob/main/CameraView/GIFs/CameraView-3.gif" width="24.5%"/>
<img alt="Popup Examples" src="https://github.com/Mijick/Assets/blob/main/CameraView/GIFs/CameraView-4.gif" width="24.5%"/>
</p>

<br>
Expand Down Expand Up @@ -112,31 +113,57 @@ Open the info.plist file of your project. Add two new keys: `Privacy - Microphon
![CleanShot 2024-05-06 at 13 41 25](https://github.com/Mijick/CameraView/assets/23524947/5da706bd-1d16-49f9-8e58-3a416872bb68)


### 2. Insert MCameraController into the selected view
### 2. Create a new CameraManager object
Create a camera manager object in the view structure to contain MCameraController. It can be initialized with attributes, with which you will start an instance of your camera.
```Swift
struct CameraView: View {
@ObservedObject private var manager: CameraManager = .init(
outputType: .photo,
cameraPosition: .back,
cameraFilters: [.init(name: "CISepiaTone")!],
flashMode: .off,
isGridVisible: true,
focusImageColor: .blue,
focusImageSize: 100
)

(...)

var body: some View {
(...)
}

(...)
}
```


### 3. Insert MCameraController into the selected view
MCameraController contains three screens - `CameraView`, `CameraPreview` (which can be turned off) and `CameraErrorView`. Therefore, we advise that there should be no other elements in the view where you declare `MCameraController`. We’ve designed this system around the experience and needs of ourselves and the developers we know. However, if your preferences are different, we are happy to meet your expectations and adapt our library. Share them with us by creating an [issue][AddIssue] for this project.
```Swift
struct CameraView: View {
@ObservedObject private var manager: CameraManager = (...)

(...)

var body: some View {
MCameraController()
MCameraController(manager: manager)
}

(...)
}
```


### 3. Declare `onImageCaptured`, `onVideoCaptured`, `afterMediaCaptured` and `onCloseController`
### 4. Declare `onImageCaptured`, `onVideoCaptured`, `afterMediaCaptured` and `onCloseController`
The above functions define what happens after a given action and are optional; for example, if your application only captures images, you don't need to declare onVideoCaptured and so on.
```Swift
struct CameraView: View {

(...)

var body: some View {
MCameraController()
MCameraController(manager: manager)
.onImageCaptured { data in
print("IMAGE CAPTURED")
}
Expand All @@ -156,7 +183,7 @@ struct CameraView: View {
```


### 4. (Optional) Block screen rotation for MCameraController
### 5. (Optional) Block screen rotation for MCameraController
CameraView library by Mijick, allows you to lock the screen rotation for `MCameraController`, even if a **device rotation is unlocked**.
To achieve it, create an AppDelegate class conforming to `MApplicationDelegate`, declare `@UIApplicationDelegateAdaptor` in `@main struct` and set `lockOrientation(AppDelegate.self)` for `MCameraController`.
```Swift
Expand All @@ -183,39 +210,14 @@ struct CameraView: View {
(...)

var body: some View {
MCameraController()
MCameraController(manager: manager)
.lockOrientation(AppDelegate.self)
}

(...)
}
```


### 5. (Optional) Change the initial camera settings
You can change the initial camera settings using the modifiers from the list below:
```Swift
struct CameraView: View {

(...)

var body: some View {
MCameraController()
.outputType(.video)
.cameraPosition(.front)
.flashMode(.auto)
.gridVisible(false)
.focusImage(.init(named: "icon-focus")!)
.focusImageColor(.blue)
.focusImageSize(120)
.changeCameraFilters([.init(name: "CISepiaTone")!])
}

(...)
}
```


### 6. (Optional) Change CameraView UI
You can change the appearance of the `CameraView` by creating a new structure, conforming to `MCameraView` and using the `cameraScreen` modifier.
```Swift
Expand Down Expand Up @@ -253,7 +255,7 @@ struct CameraView: View {
(...)

var body: some View {
MCameraController()
MCameraController(manager: manager)
.cameraScreen(CustomCameraView.init)
}

Expand Down Expand Up @@ -317,7 +319,7 @@ struct CameraView: View {
(...)

var body: some View {
MCameraController()
MCameraController(manager: manager)
.mediaPreviewScreen(CustomCameraPreview.init)
}

Expand Down Expand Up @@ -346,7 +348,7 @@ struct CameraView: View {
(...)

var body: some View {
MCameraController()
MCameraController(manager: manager)
.errorScreen(CustomCameraErrorView.init)
}

Expand Down
Loading