├── Camera-SwiftUI
├── Assets.xcassets
│ ├── Contents.json
│ ├── AccentColor.colorset
│ │ └── Contents.json
│ └── AppIcon.appiconset
│ │ └── Contents.json
├── Preview Content
│ └── Preview Assets.xcassets
│ │ └── Contents.json
├── Info.plist
├── SampleCode.xcconfig
├── Camera_SwiftUIApp.swift
├── ContentView.swift
├── ViewModel.swift
├── CameraView.swift
└── CameraManager.swift
├── resources
├── CreatewithSwift-Hero.gif
├── createwithswift-articles.png
├── createwithswift-followonx.png
├── createwithswift-linkedin.png
└── createwithswift_icon_circle.png
├── LICENSE
├── .gitignore
├── README.md
└── Camera-SwiftUI.xcodeproj
└── project.pbxproj
/Camera-SwiftUI/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "author" : "xcode",
4 | "version" : 1
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/resources/CreatewithSwift-Hero.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/create-with-swift/Camera-capture-setup-in-SwiftUI/HEAD/resources/CreatewithSwift-Hero.gif
--------------------------------------------------------------------------------
/Camera-SwiftUI/Preview Content/Preview Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "author" : "xcode",
4 | "version" : 1
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/resources/createwithswift-articles.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/create-with-swift/Camera-capture-setup-in-SwiftUI/HEAD/resources/createwithswift-articles.png
--------------------------------------------------------------------------------
/resources/createwithswift-followonx.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/create-with-swift/Camera-capture-setup-in-SwiftUI/HEAD/resources/createwithswift-followonx.png
--------------------------------------------------------------------------------
/resources/createwithswift-linkedin.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/create-with-swift/Camera-capture-setup-in-SwiftUI/HEAD/resources/createwithswift-linkedin.png
--------------------------------------------------------------------------------
/resources/createwithswift_icon_circle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/create-with-swift/Camera-capture-setup-in-SwiftUI/HEAD/resources/createwithswift_icon_circle.png
--------------------------------------------------------------------------------
/Camera-SwiftUI/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Camera-SwiftUI/Assets.xcassets/AccentColor.colorset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "colors" : [
3 | {
4 | "idiom" : "universal"
5 | }
6 | ],
7 | "info" : {
8 | "author" : "xcode",
9 | "version" : 1
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Camera-SwiftUI/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "platform" : "ios",
6 | "size" : "1024x1024"
7 | }
8 | ],
9 | "info" : {
10 | "author" : "xcode",
11 | "version" : 1
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Camera-SwiftUI/SampleCode.xcconfig:
--------------------------------------------------------------------------------
1 | //
2 | // SampleCode.xcconfig
3 | // Camera-SwiftUI
4 | //
5 | // Created by Gianluca Orpello on 28/03/24.
6 | //
7 |
8 | // Configuration settings file format documentation can be found at:
9 | // https://help.apple.com/xcode/#/dev745c5c974
10 |
11 | SAMPLE_CODE_DISAMBIGUATOR=${DEVELOPMENT_TEAM}
12 |
--------------------------------------------------------------------------------
/Camera-SwiftUI/Camera_SwiftUIApp.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Camera_SwiftUIApp.swift
3 | // Camera-SwiftUI
4 | //
5 | // Created by Gianluca Orpello on 27/02/24.
6 | //
7 |
8 | import SwiftUI
9 |
10 | @main
11 | struct Camera_SwiftUIApp: App {
12 | var body: some Scene {
13 | WindowGroup {
14 | ContentView()
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Camera-SwiftUI/ContentView.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ContentView.swift
3 | // Camera-SwiftUI
4 | //
5 | // Created by Gianluca Orpello on 27/02/24.
6 | //
7 |
8 | import SwiftUI
9 |
10 | struct ContentView: View {
11 |
12 | @State
13 | private var viewModel = ViewModel()
14 |
15 | var body: some View {
16 | CameraView(image: $viewModel.currentFrame)
17 | .ignoresSafeArea()
18 | }
19 | }
20 |
21 | #Preview {
22 | ContentView()
23 | }
24 |
--------------------------------------------------------------------------------
/Camera-SwiftUI/ViewModel.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ViewModel.swift
3 | // Camera-SwiftUI
4 | //
5 | // Created by Gianluca Orpello on 27/02/24.
6 | //
7 |
8 | import Foundation
9 | import CoreImage
10 |
11 | @Observable
12 | class ViewModel {
13 |
14 | var currentFrame: CGImage?
15 |
16 | private let cameraManager = CameraManager()
17 |
18 | init() {
19 | Task {
20 | await handleCameraPreviews()
21 | }
22 | }
23 |
24 | func handleCameraPreviews() async {
25 | for await image in cameraManager.previewStream {
26 | Task { @MainActor in
27 | currentFrame = image
28 | }
29 | }
30 | }
31 | }
32 |
33 |
--------------------------------------------------------------------------------
/Camera-SwiftUI/CameraView.swift:
--------------------------------------------------------------------------------
1 | //
2 | // CameraView.swift
3 | // Camera-SwiftUI
4 | //
5 | // Created by Gianluca Orpello on 27/02/24.
6 | //
7 |
8 | import SwiftUI
9 |
10 | struct CameraView: View {
11 |
12 | @Binding var image: CGImage?
13 |
14 | var body: some View {
15 | GeometryReader { geometry in
16 | if let image = image {
17 | Image(decorative: image, scale: 1)
18 | .resizable()
19 | .scaledToFit()
20 | .frame(width: geometry.size.width,
21 | height: geometry.size.height)
22 | } else {
23 | ContentUnavailableView("Camera feed interrupted", systemImage: "xmark.circle.fill")
24 | .frame(width: geometry.size.width,
25 | height: geometry.size.height)
26 | }
27 | }
28 | }
29 | }
30 |
31 | #Preview {
32 | CameraView(image: .constant(nil))
33 | }
34 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License.
2 |
3 | Copyright (c) 2024 Create with Swift.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Xcode
2 |
3 | .DS_Store
4 |
5 | # User settings
6 |
7 | xcuserdata/
8 |
9 | # compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
10 |
11 | *.xcscmblueprint
12 | *.xccheckout
13 |
14 | # compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
15 |
16 | build/
17 | DerivedData/
18 | *.moved-aside
19 | *.pbxuser
20 | !default.pbxuser
21 | *.mode1v3
22 | !default.mode1v3
23 | *.mode2v3
24 | !default.mode2v3
25 | *.perspectivev3
26 | !default.perspectivev3
27 |
28 | # Obj-C/Swift specific
29 |
30 | *.hmap
31 |
32 | ## App packaging
33 |
34 | *.ipa
35 | *.dSYM.zip
36 | *.dSYM
37 |
38 | # Playgrounds
39 |
40 | timeline.xctimeline
41 | playground.xcworkspace
42 |
43 | # Swift Package Manager
44 |
45 | Packages/
46 | Package.pins
47 | Package.resolved
48 | .swiftpm
49 |
50 | .build/
51 |
52 | # CocoaPods
53 |
54 | Pods/
55 | *.xcworkspace
56 |
57 | # Carthage
58 |
59 | Carthage/Build/
60 |
61 | # Accio dependency management
62 |
63 | Dependencies/
64 | .accio/
65 |
66 | # fastlane
67 |
68 | fastlane/report.xml
69 | fastlane/Preview.html
70 | fastlane/screenshots/**/*.png
71 | fastlane/test_output
72 |
73 | # Code Injection
74 |
75 | iOSInjectionProject/
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Camera capture setup in SwiftUI: The easiest way
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 | ## Content
23 |
24 | In this short tutorial you will learn how to set a camera feed capture in a SwiftUI app.
25 |
26 | You can find numerous guides discussing how to obtain a camera feed. Let’s explore a method that works on all devices that have at least one integrated camera.
27 |
28 | You will learn the easiest and quickest method to obtain a live feed and use it in an app created with SwiftUI. It serves as a foundation for incorporating a camera feed into projects that need so.
29 |
30 | [Read the full article](www.createwithswift.com/camera-capture-setup-in-a-swiftui-app)
31 |
32 | ## License
33 |
34 | MIT License.
35 |
36 | Copyright (c) 2024 Create with Swift.
37 |
38 | Permission is hereby granted, free of charge, to any person obtaining a copy
39 | of this software and associated documentation files (the "Software"), to deal
40 | in the Software without restriction, including without limitation the rights
41 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
42 | copies of the Software, and to permit persons to whom the Software is
43 | furnished to do so, subject to the following conditions:
44 |
45 | The above copyright notice and this permission notice shall be included in all
46 | copies or substantial portions of the Software.
47 |
48 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
49 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
50 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
51 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
52 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
53 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
54 | SOFTWARE.
55 |
56 |
57 |
58 | ---
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
--------------------------------------------------------------------------------
/Camera-SwiftUI/CameraManager.swift:
--------------------------------------------------------------------------------
1 | //
2 | // CameraManager.swift
3 | // Camera-SwiftUI
4 | //
5 | // Created by Gianluca Orpello on 27/02/24.
6 | //
7 |
8 | import AVFoundation
9 | import CoreImage
10 |
11 |
12 | class CameraManager: NSObject {
13 |
14 | private let captureSession = AVCaptureSession()
15 | private var deviceInput: AVCaptureDeviceInput?
16 | private var videoOutput: AVCaptureVideoDataOutput?
17 | private let systemPreferredCamera = AVCaptureDevice.default(for: .video)
18 |
19 | private var sessionQueue = DispatchQueue(label: "video.preview.session")
20 |
21 | private var addToPreviewStream: ((CGImage) -> Void)?
22 |
23 | lazy var previewStream: AsyncStream = {
24 | AsyncStream { continuation in
25 | addToPreviewStream = { cgImage in
26 | continuation.yield(cgImage)
27 | }
28 | }
29 | }()
30 |
31 | private var isAuthorized: Bool {
32 | get async {
33 | let status = AVCaptureDevice.authorizationStatus(for: .video)
34 |
35 | // Determine if the user previously authorized camera access.
36 | var isAuthorized = status == .authorized
37 |
38 | // If the system hasn't determined the user's authorization status,
39 | // explicitly prompt them for approval.
40 | if status == .notDetermined {
41 | isAuthorized = await AVCaptureDevice.requestAccess(for: .video)
42 | }
43 |
44 | return isAuthorized
45 | }
46 | }
47 |
48 | override init() {
49 | super.init()
50 |
51 | Task {
52 | await configureSession()
53 | await startSession()
54 | }
55 |
56 | }
57 |
58 | private func configureSession() async {
59 | guard await isAuthorized,
60 | let systemPreferredCamera,
61 | let deviceInput = try? AVCaptureDeviceInput(device: systemPreferredCamera)
62 | else { return }
63 |
64 | captureSession.beginConfiguration()
65 |
66 | defer {
67 | self.captureSession.commitConfiguration()
68 | }
69 |
70 | let videoOutput = AVCaptureVideoDataOutput()
71 |
72 | videoOutput.setSampleBufferDelegate(self, queue: sessionQueue)
73 |
74 | guard captureSession.canAddInput(deviceInput) else {
75 | return
76 | }
77 |
78 | guard captureSession.canAddOutput(videoOutput) else {
79 | return
80 | }
81 |
82 | captureSession.addInput(deviceInput)
83 | captureSession.addOutput(videoOutput)
84 |
85 | //For a vertical orientation of the camera stream
86 | videoOutput.connection(with: .video)?.videoRotationAngle = 90
87 | }
88 |
89 |
90 | private func startSession() async {
91 | guard await isAuthorized else { return }
92 | captureSession.startRunning()
93 | }
94 |
95 | private func rotate(by angle: CGFloat, from connection: AVCaptureConnection) {
96 | guard connection.isVideoRotationAngleSupported(angle) else { return }
97 | connection.videoRotationAngle = angle
98 | }
99 |
100 | }
101 |
102 | extension CameraManager: AVCaptureVideoDataOutputSampleBufferDelegate {
103 |
104 | func captureOutput(_ output: AVCaptureOutput, didOutput sampleBuffer: CMSampleBuffer, from connection: AVCaptureConnection) {
105 | guard let currentFrame = sampleBuffer.cgImage else {
106 | print("Can't translate to CGImage")
107 | return
108 | }
109 | addToPreviewStream?(currentFrame)
110 | }
111 |
112 | }
113 |
114 |
115 | extension CMSampleBuffer {
116 | var cgImage: CGImage? {
117 | let pixelBuffer: CVPixelBuffer? = CMSampleBufferGetImageBuffer(self)
118 | guard let imagePixelBuffer = pixelBuffer else { return nil }
119 | return CIImage(cvPixelBuffer: imagePixelBuffer).cgImage
120 | }
121 | }
122 |
123 | extension CIImage {
124 | var cgImage: CGImage? {
125 | let ciContext = CIContext()
126 | guard let cgImage = ciContext.createCGImage(self, from: self.extent) else { return nil }
127 | return cgImage
128 | }
129 | }
130 |
--------------------------------------------------------------------------------
/Camera-SwiftUI.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 56;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 992808692BB5CFC900559ABD /* SampleCode.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 992808672BB5CF0C00559ABD /* SampleCode.xcconfig */; };
11 | 99B6B58C2B8DFACE00565208 /* Camera_SwiftUIApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 99B6B58B2B8DFACE00565208 /* Camera_SwiftUIApp.swift */; };
12 | 99B6B58E2B8DFACE00565208 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 99B6B58D2B8DFACE00565208 /* ContentView.swift */; };
13 | 99B6B5902B8DFACF00565208 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 99B6B58F2B8DFACF00565208 /* Assets.xcassets */; };
14 | 99B6B5932B8DFACF00565208 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 99B6B5922B8DFACF00565208 /* Preview Assets.xcassets */; };
15 | 99B6B59A2B8DFBA700565208 /* CameraView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 99B6B5992B8DFBA700565208 /* CameraView.swift */; };
16 | 99B6B59C2B8E23E100565208 /* ViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 99B6B59B2B8E23E100565208 /* ViewModel.swift */; };
17 | 99B6B59E2B8E259000565208 /* CameraManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 99B6B59D2B8E259000565208 /* CameraManager.swift */; };
18 | /* End PBXBuildFile section */
19 |
20 | /* Begin PBXFileReference section */
21 | 992808672BB5CF0C00559ABD /* SampleCode.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = SampleCode.xcconfig; sourceTree = ""; };
22 | 998987392B922A1000A02DBB /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = ""; };
23 | 99B6B5882B8DFACE00565208 /* Camera-SwiftUI.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Camera-SwiftUI.app"; sourceTree = BUILT_PRODUCTS_DIR; };
24 | 99B6B58B2B8DFACE00565208 /* Camera_SwiftUIApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Camera_SwiftUIApp.swift; sourceTree = ""; };
25 | 99B6B58D2B8DFACE00565208 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; };
26 | 99B6B58F2B8DFACF00565208 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
27 | 99B6B5922B8DFACF00565208 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; };
28 | 99B6B5992B8DFBA700565208 /* CameraView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CameraView.swift; sourceTree = ""; };
29 | 99B6B59B2B8E23E100565208 /* ViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewModel.swift; sourceTree = ""; };
30 | 99B6B59D2B8E259000565208 /* CameraManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CameraManager.swift; sourceTree = ""; };
31 | /* End PBXFileReference section */
32 |
33 | /* Begin PBXFrameworksBuildPhase section */
34 | 99B6B5852B8DFACE00565208 /* Frameworks */ = {
35 | isa = PBXFrameworksBuildPhase;
36 | buildActionMask = 2147483647;
37 | files = (
38 | );
39 | runOnlyForDeploymentPostprocessing = 0;
40 | };
41 | /* End PBXFrameworksBuildPhase section */
42 |
43 | /* Begin PBXGroup section */
44 | 992808682BB5CF1300559ABD /* Configuration */ = {
45 | isa = PBXGroup;
46 | children = (
47 | 992808672BB5CF0C00559ABD /* SampleCode.xcconfig */,
48 | );
49 | name = Configuration;
50 | sourceTree = "";
51 | };
52 | 99B6B57F2B8DFACE00565208 = {
53 | isa = PBXGroup;
54 | children = (
55 | 99B6B58A2B8DFACE00565208 /* Camera-SwiftUI */,
56 | 99B6B5892B8DFACE00565208 /* Products */,
57 | );
58 | sourceTree = "";
59 | };
60 | 99B6B5892B8DFACE00565208 /* Products */ = {
61 | isa = PBXGroup;
62 | children = (
63 | 99B6B5882B8DFACE00565208 /* Camera-SwiftUI.app */,
64 | );
65 | name = Products;
66 | sourceTree = "";
67 | };
68 | 99B6B58A2B8DFACE00565208 /* Camera-SwiftUI */ = {
69 | isa = PBXGroup;
70 | children = (
71 | 998987392B922A1000A02DBB /* Info.plist */,
72 | 99B6B58B2B8DFACE00565208 /* Camera_SwiftUIApp.swift */,
73 | 99B6B58D2B8DFACE00565208 /* ContentView.swift */,
74 | 99B6B59B2B8E23E100565208 /* ViewModel.swift */,
75 | 99B6B59D2B8E259000565208 /* CameraManager.swift */,
76 | 99B6B5992B8DFBA700565208 /* CameraView.swift */,
77 | 99B6B58F2B8DFACF00565208 /* Assets.xcassets */,
78 | 992808682BB5CF1300559ABD /* Configuration */,
79 | 99B6B5912B8DFACF00565208 /* Preview Content */,
80 | );
81 | path = "Camera-SwiftUI";
82 | sourceTree = "";
83 | };
84 | 99B6B5912B8DFACF00565208 /* Preview Content */ = {
85 | isa = PBXGroup;
86 | children = (
87 | 99B6B5922B8DFACF00565208 /* Preview Assets.xcassets */,
88 | );
89 | path = "Preview Content";
90 | sourceTree = "";
91 | };
92 | /* End PBXGroup section */
93 |
94 | /* Begin PBXNativeTarget section */
95 | 99B6B5872B8DFACE00565208 /* Camera-SwiftUI */ = {
96 | isa = PBXNativeTarget;
97 | buildConfigurationList = 99B6B5962B8DFACF00565208 /* Build configuration list for PBXNativeTarget "Camera-SwiftUI" */;
98 | buildPhases = (
99 | 99B6B5842B8DFACE00565208 /* Sources */,
100 | 99B6B5852B8DFACE00565208 /* Frameworks */,
101 | 99B6B5862B8DFACE00565208 /* Resources */,
102 | );
103 | buildRules = (
104 | );
105 | dependencies = (
106 | );
107 | name = "Camera-SwiftUI";
108 | productName = "Camera-SwiftUI";
109 | productReference = 99B6B5882B8DFACE00565208 /* Camera-SwiftUI.app */;
110 | productType = "com.apple.product-type.application";
111 | };
112 | /* End PBXNativeTarget section */
113 |
114 | /* Begin PBXProject section */
115 | 99B6B5802B8DFACE00565208 /* Project object */ = {
116 | isa = PBXProject;
117 | attributes = {
118 | BuildIndependentTargetsInParallel = 1;
119 | LastSwiftUpdateCheck = 1520;
120 | LastUpgradeCheck = 1520;
121 | TargetAttributes = {
122 | 99B6B5872B8DFACE00565208 = {
123 | CreatedOnToolsVersion = 15.2;
124 | };
125 | };
126 | };
127 | buildConfigurationList = 99B6B5832B8DFACE00565208 /* Build configuration list for PBXProject "Camera-SwiftUI" */;
128 | compatibilityVersion = "Xcode 14.0";
129 | developmentRegion = en;
130 | hasScannedForEncodings = 0;
131 | knownRegions = (
132 | en,
133 | Base,
134 | );
135 | mainGroup = 99B6B57F2B8DFACE00565208;
136 | productRefGroup = 99B6B5892B8DFACE00565208 /* Products */;
137 | projectDirPath = "";
138 | projectRoot = "";
139 | targets = (
140 | 99B6B5872B8DFACE00565208 /* Camera-SwiftUI */,
141 | );
142 | };
143 | /* End PBXProject section */
144 |
145 | /* Begin PBXResourcesBuildPhase section */
146 | 99B6B5862B8DFACE00565208 /* Resources */ = {
147 | isa = PBXResourcesBuildPhase;
148 | buildActionMask = 2147483647;
149 | files = (
150 | 99B6B5932B8DFACF00565208 /* Preview Assets.xcassets in Resources */,
151 | 992808692BB5CFC900559ABD /* SampleCode.xcconfig in Resources */,
152 | 99B6B5902B8DFACF00565208 /* Assets.xcassets in Resources */,
153 | );
154 | runOnlyForDeploymentPostprocessing = 0;
155 | };
156 | /* End PBXResourcesBuildPhase section */
157 |
158 | /* Begin PBXSourcesBuildPhase section */
159 | 99B6B5842B8DFACE00565208 /* Sources */ = {
160 | isa = PBXSourcesBuildPhase;
161 | buildActionMask = 2147483647;
162 | files = (
163 | 99B6B59A2B8DFBA700565208 /* CameraView.swift in Sources */,
164 | 99B6B58E2B8DFACE00565208 /* ContentView.swift in Sources */,
165 | 99B6B59C2B8E23E100565208 /* ViewModel.swift in Sources */,
166 | 99B6B58C2B8DFACE00565208 /* Camera_SwiftUIApp.swift in Sources */,
167 | 99B6B59E2B8E259000565208 /* CameraManager.swift in Sources */,
168 | );
169 | runOnlyForDeploymentPostprocessing = 0;
170 | };
171 | /* End PBXSourcesBuildPhase section */
172 |
173 | /* Begin XCBuildConfiguration section */
174 | 99B6B5942B8DFACF00565208 /* Debug */ = {
175 | isa = XCBuildConfiguration;
176 | buildSettings = {
177 | ALWAYS_SEARCH_USER_PATHS = NO;
178 | ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
179 | CLANG_ANALYZER_NONNULL = YES;
180 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
181 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
182 | CLANG_ENABLE_MODULES = YES;
183 | CLANG_ENABLE_OBJC_ARC = YES;
184 | CLANG_ENABLE_OBJC_WEAK = YES;
185 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
186 | CLANG_WARN_BOOL_CONVERSION = YES;
187 | CLANG_WARN_COMMA = YES;
188 | CLANG_WARN_CONSTANT_CONVERSION = YES;
189 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
190 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
191 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
192 | CLANG_WARN_EMPTY_BODY = YES;
193 | CLANG_WARN_ENUM_CONVERSION = YES;
194 | CLANG_WARN_INFINITE_RECURSION = YES;
195 | CLANG_WARN_INT_CONVERSION = YES;
196 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
197 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
198 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
199 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
200 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
201 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
202 | CLANG_WARN_STRICT_PROTOTYPES = YES;
203 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
204 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
205 | CLANG_WARN_UNREACHABLE_CODE = YES;
206 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
207 | COPY_PHASE_STRIP = NO;
208 | DEBUG_INFORMATION_FORMAT = dwarf;
209 | ENABLE_STRICT_OBJC_MSGSEND = YES;
210 | ENABLE_TESTABILITY = YES;
211 | ENABLE_USER_SCRIPT_SANDBOXING = YES;
212 | GCC_C_LANGUAGE_STANDARD = gnu17;
213 | GCC_DYNAMIC_NO_PIC = NO;
214 | GCC_NO_COMMON_BLOCKS = YES;
215 | GCC_OPTIMIZATION_LEVEL = 0;
216 | GCC_PREPROCESSOR_DEFINITIONS = (
217 | "DEBUG=1",
218 | "$(inherited)",
219 | );
220 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
221 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
222 | GCC_WARN_UNDECLARED_SELECTOR = YES;
223 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
224 | GCC_WARN_UNUSED_FUNCTION = YES;
225 | GCC_WARN_UNUSED_VARIABLE = YES;
226 | IPHONEOS_DEPLOYMENT_TARGET = 17.2;
227 | LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
228 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
229 | MTL_FAST_MATH = YES;
230 | ONLY_ACTIVE_ARCH = YES;
231 | SDKROOT = iphoneos;
232 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)";
233 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
234 | };
235 | name = Debug;
236 | };
237 | 99B6B5952B8DFACF00565208 /* Release */ = {
238 | isa = XCBuildConfiguration;
239 | buildSettings = {
240 | ALWAYS_SEARCH_USER_PATHS = NO;
241 | ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
242 | CLANG_ANALYZER_NONNULL = YES;
243 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
244 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
245 | CLANG_ENABLE_MODULES = YES;
246 | CLANG_ENABLE_OBJC_ARC = YES;
247 | CLANG_ENABLE_OBJC_WEAK = YES;
248 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
249 | CLANG_WARN_BOOL_CONVERSION = YES;
250 | CLANG_WARN_COMMA = YES;
251 | CLANG_WARN_CONSTANT_CONVERSION = YES;
252 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
253 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
254 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
255 | CLANG_WARN_EMPTY_BODY = YES;
256 | CLANG_WARN_ENUM_CONVERSION = YES;
257 | CLANG_WARN_INFINITE_RECURSION = YES;
258 | CLANG_WARN_INT_CONVERSION = YES;
259 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
260 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
261 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
262 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
263 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
264 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
265 | CLANG_WARN_STRICT_PROTOTYPES = YES;
266 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
267 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
268 | CLANG_WARN_UNREACHABLE_CODE = YES;
269 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
270 | COPY_PHASE_STRIP = NO;
271 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
272 | ENABLE_NS_ASSERTIONS = NO;
273 | ENABLE_STRICT_OBJC_MSGSEND = YES;
274 | ENABLE_USER_SCRIPT_SANDBOXING = YES;
275 | GCC_C_LANGUAGE_STANDARD = gnu17;
276 | GCC_NO_COMMON_BLOCKS = YES;
277 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
278 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
279 | GCC_WARN_UNDECLARED_SELECTOR = YES;
280 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
281 | GCC_WARN_UNUSED_FUNCTION = YES;
282 | GCC_WARN_UNUSED_VARIABLE = YES;
283 | IPHONEOS_DEPLOYMENT_TARGET = 17.2;
284 | LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
285 | MTL_ENABLE_DEBUG_INFO = NO;
286 | MTL_FAST_MATH = YES;
287 | SDKROOT = iphoneos;
288 | SWIFT_COMPILATION_MODE = wholemodule;
289 | VALIDATE_PRODUCT = YES;
290 | };
291 | name = Release;
292 | };
293 | 99B6B5972B8DFACF00565208 /* Debug */ = {
294 | isa = XCBuildConfiguration;
295 | buildSettings = {
296 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
297 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
298 | CODE_SIGN_STYLE = Automatic;
299 | CURRENT_PROJECT_VERSION = 1;
300 | DEVELOPMENT_ASSET_PATHS = "\"Camera-SwiftUI/Preview Content\"";
301 | DEVELOPMENT_TEAM = 5QJLL8HM6C;
302 | ENABLE_PREVIEWS = YES;
303 | GENERATE_INFOPLIST_FILE = YES;
304 | INFOPLIST_FILE = "Camera-SwiftUI/Info.plist";
305 | INFOPLIST_KEY_NSCameraUsageDescription = "Get the camera feed";
306 | INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
307 | INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
308 | INFOPLIST_KEY_UILaunchScreen_Generation = YES;
309 | INFOPLIST_KEY_UISupportedInterfaceOrientations = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait";
310 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown";
311 | IPHONEOS_DEPLOYMENT_TARGET = 17.0;
312 | LD_RUNPATH_SEARCH_PATHS = (
313 | "$(inherited)",
314 | "@executable_path/Frameworks",
315 | );
316 | MARKETING_VERSION = 1.0;
317 | PRODUCT_BUNDLE_IDENTIFIER = "com.createwithswift.Camera-SwiftUI";
318 | PRODUCT_NAME = "$(TARGET_NAME)";
319 | SAMPLE_CODE_DISAMBIGUATOR = "";
320 | SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx";
321 | SUPPORTS_MACCATALYST = NO;
322 | SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
323 | SWIFT_EMIT_LOC_STRINGS = YES;
324 | SWIFT_VERSION = 5.0;
325 | TARGETED_DEVICE_FAMILY = "1,2";
326 | };
327 | name = Debug;
328 | };
329 | 99B6B5982B8DFACF00565208 /* Release */ = {
330 | isa = XCBuildConfiguration;
331 | buildSettings = {
332 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
333 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
334 | CODE_SIGN_STYLE = Automatic;
335 | CURRENT_PROJECT_VERSION = 1;
336 | DEVELOPMENT_ASSET_PATHS = "\"Camera-SwiftUI/Preview Content\"";
337 | DEVELOPMENT_TEAM = 5QJLL8HM6C;
338 | ENABLE_PREVIEWS = YES;
339 | GENERATE_INFOPLIST_FILE = YES;
340 | INFOPLIST_FILE = "Camera-SwiftUI/Info.plist";
341 | INFOPLIST_KEY_NSCameraUsageDescription = "Get the camera feed";
342 | INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
343 | INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
344 | INFOPLIST_KEY_UILaunchScreen_Generation = YES;
345 | INFOPLIST_KEY_UISupportedInterfaceOrientations = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait";
346 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown";
347 | IPHONEOS_DEPLOYMENT_TARGET = 17.0;
348 | LD_RUNPATH_SEARCH_PATHS = (
349 | "$(inherited)",
350 | "@executable_path/Frameworks",
351 | );
352 | MARKETING_VERSION = 1.0;
353 | PRODUCT_BUNDLE_IDENTIFIER = "com.createwithswift.Camera-SwiftUI";
354 | PRODUCT_NAME = "$(TARGET_NAME)";
355 | SAMPLE_CODE_DISAMBIGUATOR = "";
356 | SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx";
357 | SUPPORTS_MACCATALYST = NO;
358 | SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
359 | SWIFT_EMIT_LOC_STRINGS = YES;
360 | SWIFT_VERSION = 5.0;
361 | TARGETED_DEVICE_FAMILY = "1,2";
362 | };
363 | name = Release;
364 | };
365 | /* End XCBuildConfiguration section */
366 |
367 | /* Begin XCConfigurationList section */
368 | 99B6B5832B8DFACE00565208 /* Build configuration list for PBXProject "Camera-SwiftUI" */ = {
369 | isa = XCConfigurationList;
370 | buildConfigurations = (
371 | 99B6B5942B8DFACF00565208 /* Debug */,
372 | 99B6B5952B8DFACF00565208 /* Release */,
373 | );
374 | defaultConfigurationIsVisible = 0;
375 | defaultConfigurationName = Release;
376 | };
377 | 99B6B5962B8DFACF00565208 /* Build configuration list for PBXNativeTarget "Camera-SwiftUI" */ = {
378 | isa = XCConfigurationList;
379 | buildConfigurations = (
380 | 99B6B5972B8DFACF00565208 /* Debug */,
381 | 99B6B5982B8DFACF00565208 /* Release */,
382 | );
383 | defaultConfigurationIsVisible = 0;
384 | defaultConfigurationName = Release;
385 | };
386 | /* End XCConfigurationList section */
387 | };
388 | rootObject = 99B6B5802B8DFACE00565208 /* Project object */;
389 | }
390 |
--------------------------------------------------------------------------------