diff options
author | Ben <31181527+benedom@users.noreply.github.com> | 2024-01-26 15:33:41 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-26 15:33:41 +0100 |
commit | 74bf9219d718ee1b47a2cde7d235ac3f73992df9 (patch) | |
tree | bee70f28097261f833a52f47d15ce9bf82f918bf | |
parent | f8cfea0bf31c889d431678fea0f86e39e2819761 (diff) | |
parent | 9d895fbac4c7c653a883969ac3520f1847d299e8 (diff) |
Merge pull request #3 from leoz/master
Add demo app
12 files changed, 617 insertions, 0 deletions
diff --git a/Demo/SwiftyCropDemo.xcodeproj/project.pbxproj b/Demo/SwiftyCropDemo.xcodeproj/project.pbxproj new file mode 100644 index 0000000..de1f6b6 --- /dev/null +++ b/Demo/SwiftyCropDemo.xcodeproj/project.pbxproj @@ -0,0 +1,379 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 60; + objects = { + +/* Begin PBXBuildFile section */ + 7D0533992B60AE9C001056D4 /* SwiftyCropDemoApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D0533982B60AE9C001056D4 /* SwiftyCropDemoApp.swift */; }; + 7D05339B2B60AE9C001056D4 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D05339A2B60AE9C001056D4 /* ContentView.swift */; }; + 7D05339D2B60AE9D001056D4 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7D05339C2B60AE9D001056D4 /* Assets.xcassets */; }; + 7D0533A02B60AE9D001056D4 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7D05339F2B60AE9D001056D4 /* Preview Assets.xcassets */; }; + 7D0533A82B60AFE0001056D4 /* SwiftyCrop in Frameworks */ = {isa = PBXBuildFile; productRef = 7D0533A72B60AFE0001056D4 /* SwiftyCrop */; }; + 7D3848F02B618832009AF289 /* ShapeButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D3848EF2B618832009AF289 /* ShapeButton.swift */; }; + 7D3848F22B61888F009AF289 /* LongText.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D3848F12B61888F009AF289 /* LongText.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 7D0533952B60AE9C001056D4 /* SwiftyCropDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SwiftyCropDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 7D0533982B60AE9C001056D4 /* SwiftyCropDemoApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftyCropDemoApp.swift; sourceTree = "<group>"; }; + 7D05339A2B60AE9C001056D4 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; }; + 7D05339C2B60AE9D001056D4 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; + 7D05339F2B60AE9D001056D4 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; }; + 7D0C5DFA2B63F03F004BD980 /* SwiftyCropDemo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = SwiftyCropDemo.xcconfig; sourceTree = "<group>"; }; + 7D3848EF2B618832009AF289 /* ShapeButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShapeButton.swift; sourceTree = "<group>"; }; + 7D3848F12B61888F009AF289 /* LongText.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LongText.swift; sourceTree = "<group>"; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 7D0533922B60AE9C001056D4 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 7D0533A82B60AFE0001056D4 /* SwiftyCrop in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 7D05338C2B60AE9C001056D4 = { + isa = PBXGroup; + children = ( + 7D0533972B60AE9C001056D4 /* SwiftyCropDemo */, + 7D0533962B60AE9C001056D4 /* Products */, + ); + sourceTree = "<group>"; + }; + 7D0533962B60AE9C001056D4 /* Products */ = { + isa = PBXGroup; + children = ( + 7D0533952B60AE9C001056D4 /* SwiftyCropDemo.app */, + ); + name = Products; + sourceTree = "<group>"; + }; + 7D0533972B60AE9C001056D4 /* SwiftyCropDemo */ = { + isa = PBXGroup; + children = ( + 7D3848F12B61888F009AF289 /* LongText.swift */, + 7D3848EF2B618832009AF289 /* ShapeButton.swift */, + 7D05339A2B60AE9C001056D4 /* ContentView.swift */, + 7D0533982B60AE9C001056D4 /* SwiftyCropDemoApp.swift */, + 7D05339C2B60AE9D001056D4 /* Assets.xcassets */, + 7D05339E2B60AE9D001056D4 /* Preview Content */, + 7D0C5DFA2B63F03F004BD980 /* SwiftyCropDemo.xcconfig */, + ); + path = SwiftyCropDemo; + sourceTree = "<group>"; + }; + 7D05339E2B60AE9D001056D4 /* Preview Content */ = { + isa = PBXGroup; + children = ( + 7D05339F2B60AE9D001056D4 /* Preview Assets.xcassets */, + ); + path = "Preview Content"; + sourceTree = "<group>"; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 7D0533942B60AE9C001056D4 /* SwiftyCropDemo */ = { + isa = PBXNativeTarget; + buildConfigurationList = 7D0533A32B60AE9D001056D4 /* Build configuration list for PBXNativeTarget "SwiftyCropDemo" */; + buildPhases = ( + 7D0533912B60AE9C001056D4 /* Sources */, + 7D0533922B60AE9C001056D4 /* Frameworks */, + 7D0533932B60AE9C001056D4 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = SwiftyCropDemo; + packageProductDependencies = ( + 7D0533A72B60AFE0001056D4 /* SwiftyCrop */, + ); + productName = SwiftyCropDemo; + productReference = 7D0533952B60AE9C001056D4 /* SwiftyCropDemo.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 7D05338D2B60AE9C001056D4 /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastSwiftUpdateCheck = 1520; + LastUpgradeCheck = 1520; + TargetAttributes = { + 7D0533942B60AE9C001056D4 = { + CreatedOnToolsVersion = 15.2; + }; + }; + }; + buildConfigurationList = 7D0533902B60AE9C001056D4 /* Build configuration list for PBXProject "SwiftyCropDemo" */; + compatibilityVersion = "Xcode 14.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 7D05338C2B60AE9C001056D4; + packageReferences = ( + 7D0533A62B60AFE0001056D4 /* XCLocalSwiftPackageReference ".." */, + ); + productRefGroup = 7D0533962B60AE9C001056D4 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 7D0533942B60AE9C001056D4 /* SwiftyCropDemo */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 7D0533932B60AE9C001056D4 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 7D0533A02B60AE9D001056D4 /* Preview Assets.xcassets in Resources */, + 7D05339D2B60AE9D001056D4 /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 7D0533912B60AE9C001056D4 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 7D05339B2B60AE9C001056D4 /* ContentView.swift in Sources */, + 7D3848F02B618832009AF289 /* ShapeButton.swift in Sources */, + 7D3848F22B61888F009AF289 /* LongText.swift in Sources */, + 7D0533992B60AE9C001056D4 /* SwiftyCropDemoApp.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 7D0533A12B60AE9D001056D4 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + 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; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + 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 = 17.2; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 7D0533A22B60AE9D001056D4 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + 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; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + 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 = 17.2; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 7D0533A42B60AE9D001056D4 /* 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 = "\"SwiftyCropDemo/Preview Content\""; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + 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 = "--PRODUCT-BUNDLE-IDENTIFIER-"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 7D0533A52B60AE9D001056D4 /* 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 = "\"SwiftyCropDemo/Preview Content\""; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + 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 = "--PRODUCT-BUNDLE-IDENTIFIER-"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 7D0533902B60AE9C001056D4 /* Build configuration list for PBXProject "SwiftyCropDemo" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 7D0533A12B60AE9D001056D4 /* Debug */, + 7D0533A22B60AE9D001056D4 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 7D0533A32B60AE9D001056D4 /* Build configuration list for PBXNativeTarget "SwiftyCropDemo" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 7D0533A42B60AE9D001056D4 /* Debug */, + 7D0533A52B60AE9D001056D4 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + +/* Begin XCLocalSwiftPackageReference section */ + 7D0533A62B60AFE0001056D4 /* XCLocalSwiftPackageReference ".." */ = { + isa = XCLocalSwiftPackageReference; + relativePath = ..; + }; +/* End XCLocalSwiftPackageReference section */ + +/* Begin XCSwiftPackageProductDependency section */ + 7D0533A72B60AFE0001056D4 /* SwiftyCrop */ = { + isa = XCSwiftPackageProductDependency; + productName = SwiftyCrop; + }; +/* End XCSwiftPackageProductDependency section */ + }; + rootObject = 7D05338D2B60AE9C001056D4 /* Project object */; +} diff --git a/Demo/SwiftyCropDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Demo/SwiftyCropDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/Demo/SwiftyCropDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Workspace + version = "1.0"> + <FileRef + location = "self:"> + </FileRef> +</Workspace> diff --git a/Demo/SwiftyCropDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Demo/SwiftyCropDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/Demo/SwiftyCropDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IDEDidComputeMac32BitWarning</key> + <true/> +</dict> +</plist> diff --git a/Demo/SwiftyCropDemo/Assets.xcassets/AccentColor.colorset/Contents.json b/Demo/SwiftyCropDemo/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 0000000..eb87897 --- /dev/null +++ b/Demo/SwiftyCropDemo/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Demo/SwiftyCropDemo/Assets.xcassets/AppIcon.appiconset/Contents.json b/Demo/SwiftyCropDemo/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..13613e3 --- /dev/null +++ b/Demo/SwiftyCropDemo/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,13 @@ +{ + "images" : [ + { + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Demo/SwiftyCropDemo/Assets.xcassets/Contents.json b/Demo/SwiftyCropDemo/Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/Demo/SwiftyCropDemo/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Demo/SwiftyCropDemo/ContentView.swift b/Demo/SwiftyCropDemo/ContentView.swift new file mode 100644 index 0000000..c999dd3 --- /dev/null +++ b/Demo/SwiftyCropDemo/ContentView.swift @@ -0,0 +1,102 @@ +// +// ContentView.swift +// SwiftyCropDemo +// +// Created by Leonid Zolotarev on 1/23/24. +// + +import SwiftUI +import SwiftyCrop + +struct ContentView: View { + @State private var showImageCropper: Bool = false + @State private var selectedImage: UIImage? + @State private var selectedShape: MaskShape = .square + @State private var cropImageCircular: Bool = false + + var body: some View { + VStack { + Spacer() + Group { + if let selectedImage = selectedImage { + Image(uiImage: selectedImage) + .resizable() + .aspectRatio(contentMode: .fit) + .cornerRadius(8) + } else { + ProgressView() + } + } + .scaledToFit() + .padding() + Spacer() + GroupBox { + HStack { + Button { + loadImage() + } label: { + LongText(title: "Load image") + } + Button { + showImageCropper.toggle() + } label: { + LongText(title: "Crop image") + } + } + HStack { + ShapeButton( + title: "Use square crop", + shape: .square, + selection: $selectedShape + ) + ShapeButton( + title: "Use circle crop", + shape: .circle, + selection: $selectedShape + ) + } + Toggle("Crop image to circle", isOn: $cropImageCircular) + } + .buttonStyle(.bordered) + .padding() + } + .onAppear { + loadImage() + } + .fullScreenCover(isPresented: $showImageCropper) { + if let selectedImage = selectedImage { + SwiftyCropView( + imageToCrop: selectedImage, + maskShape: selectedShape, + configuration: SwiftyCropConfiguration( + cropImageCircular: cropImageCircular + ) + ) { croppedImage in + // Do something with the returned, cropped image + self.selectedImage = croppedImage + } + } + } + } + + private func loadImage() { + Task { + selectedImage = await downloadExampleImage() + } + } + + // Example function for downloading an image + private func downloadExampleImage() async -> UIImage? { + let urlString = "https://picsum.photos/1000/1200" + guard let url = URL(string: urlString), + let (data, _) = try? await URLSession.shared.data(from: url), + let image = UIImage(data: data) + else { return nil } + + return image + } +} + +#Preview { + ContentView() +} diff --git a/Demo/SwiftyCropDemo/LongText.swift b/Demo/SwiftyCropDemo/LongText.swift new file mode 100644 index 0000000..77e211a --- /dev/null +++ b/Demo/SwiftyCropDemo/LongText.swift @@ -0,0 +1,21 @@ +// +// LongText.swift +// SwiftyCropDemo +// +// Created by Leonid Zolotarev on 1/24/24. +// + +import SwiftUI + +struct LongText: View { + let title: String + + var body: some View { + Text(title) + .frame(maxWidth: .infinity) + } +} + +#Preview { + LongText(title: "title") +} diff --git a/Demo/SwiftyCropDemo/Preview Content/Preview Assets.xcassets/Contents.json b/Demo/SwiftyCropDemo/Preview Content/Preview Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/Demo/SwiftyCropDemo/Preview Content/Preview Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Demo/SwiftyCropDemo/ShapeButton.swift b/Demo/SwiftyCropDemo/ShapeButton.swift new file mode 100644 index 0000000..c7aae9f --- /dev/null +++ b/Demo/SwiftyCropDemo/ShapeButton.swift @@ -0,0 +1,32 @@ +// +// ShapeButton.swift +// SwiftyCropDemo +// +// Created by Leonid Zolotarev on 1/24/24. +// + +import SwiftUI +import SwiftyCrop + +struct ShapeButton: View { + let title: String + let shape: MaskShape + @Binding var selection: MaskShape + + var body: some View { + Button { + selection = shape + } label: { + LongText(title: title) + } + .foregroundColor(selection == shape ? .accentColor : .secondary) + } +} + +#Preview { + ShapeButton( + title: "title", + shape: .circle, + selection: .constant(.circle) + ) +} diff --git a/Demo/SwiftyCropDemo/SwiftyCropDemo.xcconfig b/Demo/SwiftyCropDemo/SwiftyCropDemo.xcconfig new file mode 100644 index 0000000..42270da --- /dev/null +++ b/Demo/SwiftyCropDemo/SwiftyCropDemo.xcconfig @@ -0,0 +1,15 @@ +// +// SwiftyCropDemo.xcconfig +// SwiftyCropDemo +// +// Created by Leonid Zolotarev on 1/26/24. +// + +// Configuration settings file format documentation can be found at: +// https://help.apple.com/xcode/#/dev745c5c974 + +// +DEVELOPMENT_TEAM = + +// +PRODUCT_BUNDLE_IDENTIFIER = com.leoz.SwiftyCropDemo diff --git a/Demo/SwiftyCropDemo/SwiftyCropDemoApp.swift b/Demo/SwiftyCropDemo/SwiftyCropDemoApp.swift new file mode 100644 index 0000000..fb7e2bb --- /dev/null +++ b/Demo/SwiftyCropDemo/SwiftyCropDemoApp.swift @@ -0,0 +1,17 @@ +// +// SwiftyCropDemoApp.swift +// SwiftyCropDemo +// +// Created by Leonid Zolotarev on 1/23/24. +// + +import SwiftUI + +@main +struct SwiftyCropDemoApp: App { + var body: some Scene { + WindowGroup { + ContentView() + } + } +} |