diff --git a/DemoApp/DemoApp.xcodeproj/project.pbxproj b/DemoApp/DemoApp.xcodeproj/project.pbxproj new file mode 100644 index 0000000..1fce4d2 --- /dev/null +++ b/DemoApp/DemoApp.xcodeproj/project.pbxproj @@ -0,0 +1,620 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 55; + objects = { + +/* Begin PBXBuildFile section */ + A9E714B928B7892F00A273A7 /* DemoAppApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9E714B828B7892F00A273A7 /* DemoAppApp.swift */; }; + A9E714BB28B7892F00A273A7 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9E714BA28B7892F00A273A7 /* ContentView.swift */; }; + A9E714BD28B7893100A273A7 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A9E714BC28B7893100A273A7 /* Assets.xcassets */; }; + A9E714C028B7893100A273A7 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A9E714BF28B7893100A273A7 /* Preview Assets.xcassets */; }; + A9E714CA28B7893100A273A7 /* DemoAppTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9E714C928B7893100A273A7 /* DemoAppTests.swift */; }; + A9E714D428B7893100A273A7 /* DemoAppUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9E714D328B7893100A273A7 /* DemoAppUITests.swift */; }; + A9E714D628B7893100A273A7 /* DemoAppUITestsLaunchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9E714D528B7893100A273A7 /* DemoAppUITestsLaunchTests.swift */; }; + A9E714E628B789A100A273A7 /* Camera-SwiftUI in Frameworks */ = {isa = PBXBuildFile; productRef = A9E714E528B789A100A273A7 /* Camera-SwiftUI */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + A9E714C628B7893100A273A7 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = A9E714AD28B7892F00A273A7 /* Project object */; + proxyType = 1; + remoteGlobalIDString = A9E714B428B7892F00A273A7; + remoteInfo = DemoApp; + }; + A9E714D028B7893100A273A7 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = A9E714AD28B7892F00A273A7 /* Project object */; + proxyType = 1; + remoteGlobalIDString = A9E714B428B7892F00A273A7; + remoteInfo = DemoApp; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + A9E714B528B7892F00A273A7 /* DemoApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DemoApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; + A9E714B828B7892F00A273A7 /* DemoAppApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DemoAppApp.swift; sourceTree = ""; }; + A9E714BA28B7892F00A273A7 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; + A9E714BC28B7893100A273A7 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + A9E714BF28B7893100A273A7 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; + A9E714C528B7893100A273A7 /* DemoAppTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DemoAppTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + A9E714C928B7893100A273A7 /* DemoAppTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DemoAppTests.swift; sourceTree = ""; }; + A9E714CF28B7893100A273A7 /* DemoAppUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DemoAppUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + A9E714D328B7893100A273A7 /* DemoAppUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DemoAppUITests.swift; sourceTree = ""; }; + A9E714D528B7893100A273A7 /* DemoAppUITestsLaunchTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DemoAppUITestsLaunchTests.swift; sourceTree = ""; }; + A9E714E328B7898200A273A7 /* Camera-SwiftUI */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = "Camera-SwiftUI"; path = ..; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + A9E714B228B7892F00A273A7 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + A9E714E628B789A100A273A7 /* Camera-SwiftUI in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A9E714C228B7893100A273A7 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A9E714CC28B7893100A273A7 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + A9E714AC28B7892F00A273A7 = { + isa = PBXGroup; + children = ( + A9E714E228B7898200A273A7 /* Packages */, + A9E714B728B7892F00A273A7 /* DemoApp */, + A9E714C828B7893100A273A7 /* DemoAppTests */, + A9E714D228B7893100A273A7 /* DemoAppUITests */, + A9E714B628B7892F00A273A7 /* Products */, + A9E714E428B789A100A273A7 /* Frameworks */, + ); + sourceTree = ""; + }; + A9E714B628B7892F00A273A7 /* Products */ = { + isa = PBXGroup; + children = ( + A9E714B528B7892F00A273A7 /* DemoApp.app */, + A9E714C528B7893100A273A7 /* DemoAppTests.xctest */, + A9E714CF28B7893100A273A7 /* DemoAppUITests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + A9E714B728B7892F00A273A7 /* DemoApp */ = { + isa = PBXGroup; + children = ( + A9E714B828B7892F00A273A7 /* DemoAppApp.swift */, + A9E714BA28B7892F00A273A7 /* ContentView.swift */, + A9E714BC28B7893100A273A7 /* Assets.xcassets */, + A9E714BE28B7893100A273A7 /* Preview Content */, + ); + path = DemoApp; + sourceTree = ""; + }; + A9E714BE28B7893100A273A7 /* Preview Content */ = { + isa = PBXGroup; + children = ( + A9E714BF28B7893100A273A7 /* Preview Assets.xcassets */, + ); + path = "Preview Content"; + sourceTree = ""; + }; + A9E714C828B7893100A273A7 /* DemoAppTests */ = { + isa = PBXGroup; + children = ( + A9E714C928B7893100A273A7 /* DemoAppTests.swift */, + ); + path = DemoAppTests; + sourceTree = ""; + }; + A9E714D228B7893100A273A7 /* DemoAppUITests */ = { + isa = PBXGroup; + children = ( + A9E714D328B7893100A273A7 /* DemoAppUITests.swift */, + A9E714D528B7893100A273A7 /* DemoAppUITestsLaunchTests.swift */, + ); + path = DemoAppUITests; + sourceTree = ""; + }; + A9E714E228B7898200A273A7 /* Packages */ = { + isa = PBXGroup; + children = ( + A9E714E328B7898200A273A7 /* Camera-SwiftUI */, + ); + name = Packages; + sourceTree = ""; + }; + A9E714E428B789A100A273A7 /* Frameworks */ = { + isa = PBXGroup; + children = ( + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + A9E714B428B7892F00A273A7 /* DemoApp */ = { + isa = PBXNativeTarget; + buildConfigurationList = A9E714D928B7893100A273A7 /* Build configuration list for PBXNativeTarget "DemoApp" */; + buildPhases = ( + A9E714B128B7892F00A273A7 /* Sources */, + A9E714B228B7892F00A273A7 /* Frameworks */, + A9E714B328B7892F00A273A7 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = DemoApp; + packageProductDependencies = ( + A9E714E528B789A100A273A7 /* Camera-SwiftUI */, + ); + productName = DemoApp; + productReference = A9E714B528B7892F00A273A7 /* DemoApp.app */; + productType = "com.apple.product-type.application"; + }; + A9E714C428B7893100A273A7 /* DemoAppTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = A9E714DC28B7893100A273A7 /* Build configuration list for PBXNativeTarget "DemoAppTests" */; + buildPhases = ( + A9E714C128B7893100A273A7 /* Sources */, + A9E714C228B7893100A273A7 /* Frameworks */, + A9E714C328B7893100A273A7 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + A9E714C728B7893100A273A7 /* PBXTargetDependency */, + ); + name = DemoAppTests; + productName = DemoAppTests; + productReference = A9E714C528B7893100A273A7 /* DemoAppTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + A9E714CE28B7893100A273A7 /* DemoAppUITests */ = { + isa = PBXNativeTarget; + buildConfigurationList = A9E714DF28B7893100A273A7 /* Build configuration list for PBXNativeTarget "DemoAppUITests" */; + buildPhases = ( + A9E714CB28B7893100A273A7 /* Sources */, + A9E714CC28B7893100A273A7 /* Frameworks */, + A9E714CD28B7893100A273A7 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + A9E714D128B7893100A273A7 /* PBXTargetDependency */, + ); + name = DemoAppUITests; + productName = DemoAppUITests; + productReference = A9E714CF28B7893100A273A7 /* DemoAppUITests.xctest */; + productType = "com.apple.product-type.bundle.ui-testing"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + A9E714AD28B7892F00A273A7 /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastSwiftUpdateCheck = 1330; + LastUpgradeCheck = 1330; + TargetAttributes = { + A9E714B428B7892F00A273A7 = { + CreatedOnToolsVersion = 13.3.1; + }; + A9E714C428B7893100A273A7 = { + CreatedOnToolsVersion = 13.3.1; + TestTargetID = A9E714B428B7892F00A273A7; + }; + A9E714CE28B7893100A273A7 = { + CreatedOnToolsVersion = 13.3.1; + TestTargetID = A9E714B428B7892F00A273A7; + }; + }; + }; + buildConfigurationList = A9E714B028B7892F00A273A7 /* Build configuration list for PBXProject "DemoApp" */; + compatibilityVersion = "Xcode 13.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = A9E714AC28B7892F00A273A7; + productRefGroup = A9E714B628B7892F00A273A7 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + A9E714B428B7892F00A273A7 /* DemoApp */, + A9E714C428B7893100A273A7 /* DemoAppTests */, + A9E714CE28B7893100A273A7 /* DemoAppUITests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + A9E714B328B7892F00A273A7 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A9E714C028B7893100A273A7 /* Preview Assets.xcassets in Resources */, + A9E714BD28B7893100A273A7 /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A9E714C328B7893100A273A7 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A9E714CD28B7893100A273A7 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + A9E714B128B7892F00A273A7 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A9E714BB28B7892F00A273A7 /* ContentView.swift in Sources */, + A9E714B928B7892F00A273A7 /* DemoAppApp.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A9E714C128B7893100A273A7 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A9E714CA28B7893100A273A7 /* DemoAppTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A9E714CB28B7893100A273A7 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A9E714D428B7893100A273A7 /* DemoAppUITests.swift in Sources */, + A9E714D628B7893100A273A7 /* DemoAppUITestsLaunchTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + A9E714C728B7893100A273A7 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = A9E714B428B7892F00A273A7 /* DemoApp */; + targetProxy = A9E714C628B7893100A273A7 /* PBXContainerItemProxy */; + }; + A9E714D128B7893100A273A7 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = A9E714B428B7892F00A273A7 /* DemoApp */; + targetProxy = A9E714D028B7893100A273A7 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + A9E714D728B7893100A273A7 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 15.4; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + A9E714D828B7893100A273A7 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 15.4; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + A9E714DA28B7893100A273A7 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_ASSET_PATHS = "\"DemoApp/Preview Content\""; + DEVELOPMENT_TEAM = YAFLRP6JUR; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_NSCameraUsageDescription = "DemoApp needs to access your camera to take pictures."; + INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchScreen_Generation = YES; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = rry.com.DemoApp; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + A9E714DB28B7893100A273A7 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_ASSET_PATHS = "\"DemoApp/Preview Content\""; + DEVELOPMENT_TEAM = YAFLRP6JUR; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_NSCameraUsageDescription = "DemoApp needs to access your camera to take pictures."; + INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchScreen_Generation = YES; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = rry.com.DemoApp; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; + A9E714DD28B7893100A273A7 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = YAFLRP6JUR; + GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 15.4; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = rry.com.DemoAppTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/DemoApp.app/DemoApp"; + }; + name = Debug; + }; + A9E714DE28B7893100A273A7 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = YAFLRP6JUR; + GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 15.4; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = rry.com.DemoAppTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/DemoApp.app/DemoApp"; + }; + name = Release; + }; + A9E714E028B7893100A273A7 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = YAFLRP6JUR; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = rry.com.DemoAppUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_TARGET_NAME = DemoApp; + }; + name = Debug; + }; + A9E714E128B7893100A273A7 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = YAFLRP6JUR; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = rry.com.DemoAppUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_TARGET_NAME = DemoApp; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + A9E714B028B7892F00A273A7 /* Build configuration list for PBXProject "DemoApp" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A9E714D728B7893100A273A7 /* Debug */, + A9E714D828B7893100A273A7 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + A9E714D928B7893100A273A7 /* Build configuration list for PBXNativeTarget "DemoApp" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A9E714DA28B7893100A273A7 /* Debug */, + A9E714DB28B7893100A273A7 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + A9E714DC28B7893100A273A7 /* Build configuration list for PBXNativeTarget "DemoAppTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A9E714DD28B7893100A273A7 /* Debug */, + A9E714DE28B7893100A273A7 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + A9E714DF28B7893100A273A7 /* Build configuration list for PBXNativeTarget "DemoAppUITests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A9E714E028B7893100A273A7 /* Debug */, + A9E714E128B7893100A273A7 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + +/* Begin XCSwiftPackageProductDependency section */ + A9E714E528B789A100A273A7 /* Camera-SwiftUI */ = { + isa = XCSwiftPackageProductDependency; + productName = "Camera-SwiftUI"; + }; +/* End XCSwiftPackageProductDependency section */ + }; + rootObject = A9E714AD28B7892F00A273A7 /* Project object */; +} diff --git a/DemoApp/DemoApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/DemoApp/DemoApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/DemoApp/DemoApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/DemoApp/DemoApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/DemoApp/DemoApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/DemoApp/DemoApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/DemoApp/DemoApp/Assets.xcassets/AccentColor.colorset/Contents.json b/DemoApp/DemoApp/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 0000000..eb87897 --- /dev/null +++ b/DemoApp/DemoApp/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DemoApp/DemoApp/Assets.xcassets/AppIcon.appiconset/Contents.json b/DemoApp/DemoApp/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..5a3257a --- /dev/null +++ b/DemoApp/DemoApp/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,93 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "20x20" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "20x20" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "29x29" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "29x29" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "60x60" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "60x60" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "20x20" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "20x20" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "29x29" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "29x29" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "40x40" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "40x40" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "76x76" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "83.5x83.5" + }, + { + "idiom" : "ios-marketing", + "scale" : "1x", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DemoApp/DemoApp/Assets.xcassets/Contents.json b/DemoApp/DemoApp/Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/DemoApp/DemoApp/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DemoApp/DemoApp/ContentView.swift b/DemoApp/DemoApp/ContentView.swift new file mode 100644 index 0000000..86b71e2 --- /dev/null +++ b/DemoApp/DemoApp/ContentView.swift @@ -0,0 +1,206 @@ +// +// ContentView.swift +// DemoApp +// +// Created by Rolando Rodriguez on 8/25/22. +// + +import SwiftUI +import Combine +import Camera_SwiftUI +import AVFoundation + +final class CameraModel: ObservableObject { + private let service = CameraService() + + @Published var photo: Photo! + + @Published var showAlertError = false + + @Published var isFlashOn = false + + @Published var willCapturePhoto = false + + var alertError: AlertError! + + var session: AVCaptureSession + + private var subscriptions = Set() + + init() { + self.session = service.session + + service.$photo.sink { [weak self] (photo) in + guard let pic = photo else { return } + self?.photo = pic + } + .store(in: &self.subscriptions) + + service.$shouldShowAlertView.sink { [weak self] (val) in + self?.alertError = self?.service.alertError + self?.showAlertError = val + } + .store(in: &self.subscriptions) + + service.$flashMode.sink { [weak self] (mode) in + self?.isFlashOn = mode == .on + } + .store(in: &self.subscriptions) + + service.$willCapturePhoto.sink { [weak self] (val) in + self?.willCapturePhoto = val + } + .store(in: &self.subscriptions) + } + + func configure() { + service.checkForPermissions() + service.configure() + } + + func capturePhoto() { + service.capturePhoto() + } + + func flipCamera() { + service.changeCamera() + } + + func zoom(with factor: CGFloat) { + service.set(zoom: factor) + } + + func switchFlash() { + service.flashMode = service.flashMode == .on ? .off : .on + } +} + +struct CameraView: View { + @StateObject var model = CameraModel() + + @State var currentZoomFactor: CGFloat = 1.0 + + var captureButton: some View { + Button(action: { + model.capturePhoto() + }, label: { + Circle() + .foregroundColor(.white) + .frame(width: 80, height: 80, alignment: .center) + .overlay( + Circle() + .stroke(Color.black.opacity(0.8), lineWidth: 2) + .frame(width: 65, height: 65, alignment: .center) + ) + }) + } + + var capturedPhotoThumbnail: some View { + Group { + if model.photo != nil { + Image(uiImage: model.photo.image!) + .resizable() + .aspectRatio(contentMode: .fill) + .frame(width: 60, height: 60) + .clipShape(RoundedRectangle(cornerRadius: 10, style: .continuous)) + .animation(.spring()) + + } else { + RoundedRectangle(cornerRadius: 10) + .frame(width: 60, height: 60, alignment: .center) + .foregroundColor(.black) + } + } + } + + var flipCameraButton: some View { + Button(action: { + model.flipCamera() + }, label: { + Circle() + .foregroundColor(Color.gray.opacity(0.2)) + .frame(width: 45, height: 45, alignment: .center) + .overlay( + Image(systemName: "camera.rotate.fill") + .foregroundColor(.white)) + }) + } + + var body: some View { + NavigationView { + GeometryReader { reader in + ZStack { + Color.black.edgesIgnoringSafeArea(.all) + + VStack { + Button(action: { + model.switchFlash() + }, label: { + Image(systemName: model.isFlashOn ? "bolt.fill" : "bolt.slash.fill") + .font(.system(size: 20, weight: .medium, design: .default)) + }) + .accentColor(model.isFlashOn ? .yellow : .white) + + CameraPreview(session: model.session) + .gesture( + DragGesture().onChanged({ (val) in + // Only accept vertical drag + if abs(val.translation.height) > abs(val.translation.width) { + // Get the percentage of vertical screen space covered by drag + let percentage: CGFloat = -(val.translation.height / reader.size.height) + // Calculate new zoom factor + let calc = currentZoomFactor + percentage + // Limit zoom factor to a maximum of 5x and a minimum of 1x + let zoomFactor: CGFloat = min(max(calc, 1), 5) + // Store the newly calculated zoom factor + currentZoomFactor = zoomFactor + // Sets the zoom factor to the capture device session + model.zoom(with: zoomFactor) + } + }) + ) + .onAppear { + model.configure() + } + .alert(isPresented: $model.showAlertError, content: { + Alert(title: Text(model.alertError.title), message: Text(model.alertError.message), dismissButton: .default(Text(model.alertError.primaryButtonTitle), action: { + model.alertError.primaryAction?() + })) + }) + .overlay( + Group { + if model.willCapturePhoto { + Color.black + } + } + ) + .animation(.easeInOut) + + + HStack { + NavigationLink(destination: Text("Detail photo")) { + capturedPhotoThumbnail + } + + Spacer() + + captureButton + + Spacer() + + flipCameraButton + + } + .padding(.horizontal, 20) + } + } + } + } + } +} + +struct ContentView_Previews: PreviewProvider { + static var previews: some View { + CameraView() + } +} diff --git a/DemoApp/DemoApp/DemoAppApp.swift b/DemoApp/DemoApp/DemoAppApp.swift new file mode 100644 index 0000000..091a394 --- /dev/null +++ b/DemoApp/DemoApp/DemoAppApp.swift @@ -0,0 +1,17 @@ +// +// DemoAppApp.swift +// DemoApp +// +// Created by Rolando Rodriguez on 8/25/22. +// + +import SwiftUI + +@main +struct DemoAppApp: App { + var body: some Scene { + WindowGroup { + CameraView() + } + } +} diff --git a/DemoApp/DemoApp/Preview Content/Preview Assets.xcassets/Contents.json b/DemoApp/DemoApp/Preview Content/Preview Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/DemoApp/DemoApp/Preview Content/Preview Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DemoApp/DemoAppTests/DemoAppTests.swift b/DemoApp/DemoAppTests/DemoAppTests.swift new file mode 100644 index 0000000..8ea1d44 --- /dev/null +++ b/DemoApp/DemoAppTests/DemoAppTests.swift @@ -0,0 +1,36 @@ +// +// DemoAppTests.swift +// DemoAppTests +// +// Created by Rolando Rodriguez on 8/25/22. +// + +import XCTest +@testable import DemoApp + +class DemoAppTests: XCTestCase { + + override func setUpWithError() throws { + // Put setup code here. This method is called before the invocation of each test method in the class. + } + + override func tearDownWithError() throws { + // Put teardown code here. This method is called after the invocation of each test method in the class. + } + + func testExample() throws { + // This is an example of a functional test case. + // Use XCTAssert and related functions to verify your tests produce the correct results. + // Any test you write for XCTest can be annotated as throws and async. + // Mark your test throws to produce an unexpected failure when your test encounters an uncaught error. + // Mark your test async to allow awaiting for asynchronous code to complete. Check the results with assertions afterwards. + } + + func testPerformanceExample() throws { + // This is an example of a performance test case. + self.measure { + // Put the code you want to measure the time of here. + } + } + +} diff --git a/DemoApp/DemoAppUITests/DemoAppUITests.swift b/DemoApp/DemoAppUITests/DemoAppUITests.swift new file mode 100644 index 0000000..96b99bc --- /dev/null +++ b/DemoApp/DemoAppUITests/DemoAppUITests.swift @@ -0,0 +1,41 @@ +// +// DemoAppUITests.swift +// DemoAppUITests +// +// Created by Rolando Rodriguez on 8/25/22. +// + +import XCTest + +class DemoAppUITests: XCTestCase { + + override func setUpWithError() throws { + // Put setup code here. This method is called before the invocation of each test method in the class. + + // In UI tests it is usually best to stop immediately when a failure occurs. + continueAfterFailure = false + + // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. + } + + override func tearDownWithError() throws { + // Put teardown code here. This method is called after the invocation of each test method in the class. + } + + func testExample() throws { + // UI tests must launch the application that they test. + let app = XCUIApplication() + app.launch() + + // Use XCTAssert and related functions to verify your tests produce the correct results. + } + + func testLaunchPerformance() throws { + if #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 7.0, *) { + // This measures how long it takes to launch your application. + measure(metrics: [XCTApplicationLaunchMetric()]) { + XCUIApplication().launch() + } + } + } +} diff --git a/DemoApp/DemoAppUITests/DemoAppUITestsLaunchTests.swift b/DemoApp/DemoAppUITests/DemoAppUITestsLaunchTests.swift new file mode 100644 index 0000000..7e95daf --- /dev/null +++ b/DemoApp/DemoAppUITests/DemoAppUITestsLaunchTests.swift @@ -0,0 +1,32 @@ +// +// DemoAppUITestsLaunchTests.swift +// DemoAppUITests +// +// Created by Rolando Rodriguez on 8/25/22. +// + +import XCTest + +class DemoAppUITestsLaunchTests: XCTestCase { + + override class var runsForEachTargetApplicationUIConfiguration: Bool { + true + } + + override func setUpWithError() throws { + continueAfterFailure = false + } + + func testLaunch() throws { + let app = XCUIApplication() + app.launch() + + // Insert steps here to perform after app launch but before taking a screenshot, + // such as logging into a test account or navigating somewhere in the app + + let attachment = XCTAttachment(screenshot: app.screenshot()) + attachment.name = "Launch Screen" + attachment.lifetime = .keepAlways + add(attachment) + } +} diff --git a/Sources/Camera-SwiftUI/Service/CameraService.swift b/Sources/Camera-SwiftUI/Service/CameraService.swift index 1471ee5..3dca2eb 100644 --- a/Sources/Camera-SwiftUI/Service/CameraService.swift +++ b/Sources/Camera-SwiftUI/Service/CameraService.swift @@ -113,18 +113,20 @@ public class CameraService: NSObject, Identifiable { } public func configure() { - /* - Setup the capture session. - In general, it's not safe to mutate an AVCaptureSession or any of its - inputs, outputs, or connections from multiple threads at the same time. - - Don't perform these tasks on the main queue because - AVCaptureSession.startRunning() is a blocking call, which can - take a long time. Dispatch session setup to the sessionQueue, so - that the main queue isn't blocked, which keeps the UI responsive. - */ - sessionQueue.async { - self.configureSession() + if !self.isSessionRunning && !self.isConfigured { + /* + Setup the capture session. + In general, it's not safe to mutate an AVCaptureSession or any of its + inputs, outputs, or connections from multiple threads at the same time. + + Don't perform these tasks on the main queue because + AVCaptureSession.startRunning() is a blocking call, which can + take a long time. Dispatch session setup to the sessionQueue, so + that the main queue isn't blocked, which keeps the UI responsive. + */ + sessionQueue.async { + self.configureSession() + } } }