diff --git a/Example/LICENSE b/Example/LICENSE new file mode 100644 index 0000000..3486029 --- /dev/null +++ b/Example/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Christian Elies + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Example/README.md b/Example/README.md new file mode 100644 index 0000000..664d4ef --- /dev/null +++ b/Example/README.md @@ -0,0 +1,31 @@ +# RemoteImage-SwiftUI + +Remote Image view with error and loading state for **SwiftUI** + +This repository contains a usage example of my Swift package for a remote **SwiftUI** `Image view` to show remote images. +You can find the Swift package [here](https://github.com/crelies/RemoteImage). + +## Motivation + +I wanted to have a simple and extendable remote image view in **SwiftUI** which takes care of all the magic +(image loading, caching, error and loading view). At my current employer we used a custom **UIKit** view for that. + +## Preview + +![Animated preview image](https://github.com/crelies/RemoteImage-SwiftUI/blob/master/RemoteImage.gif) + +Code: + +```swift +let url = URL(string: "https://images.unsplash.com/photo-1524419986249-348e8fa6ad4a?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1950&q=80")! + +RemoteImage(type: ./service/https://github.com/url(url), errorView: { error in + Text(error.localizedDescription) +}, image: { image in + image + .resizable() + .aspectRatio(contentMode: .fit) +}, loadingView: { + Text("Loading ...") +}) +``` diff --git a/Example/RemoteImage-Example.entitlements b/Example/RemoteImage-Example.entitlements new file mode 100644 index 0000000..ee95ab7 --- /dev/null +++ b/Example/RemoteImage-Example.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.network.client + + + diff --git a/Example/RemoteImage-Example.xcodeproj/project.pbxproj b/Example/RemoteImage-Example.xcodeproj/project.pbxproj new file mode 100644 index 0000000..3c680e1 --- /dev/null +++ b/Example/RemoteImage-Example.xcodeproj/project.pbxproj @@ -0,0 +1,388 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 52; + objects = { + +/* Begin PBXBuildFile section */ + B944333C24D8A503000A7914 /* RemoteImage_ExampleApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = B944332A24D8A503000A7914 /* RemoteImage_ExampleApp.swift */; }; + B944334024D8A503000A7914 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B944332C24D8A503000A7914 /* Assets.xcassets */; }; + B944334824D8A5F9000A7914 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B966957F2300A03C00D249D3 /* ContentView.swift */; }; + B944334C24D8A61F000A7914 /* RemoteImage in Frameworks */ = {isa = PBXBuildFile; productRef = B944334B24D8A61F000A7914 /* RemoteImage */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + B944332A24D8A503000A7914 /* RemoteImage_ExampleApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RemoteImage_ExampleApp.swift; sourceTree = ""; }; + B944332C24D8A503000A7914 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + B944333124D8A503000A7914 /* RemoteImage-Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "RemoteImage-Example.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + B944333324D8A503000A7914 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + B944335124D8A8C7000A7914 /* RemoteImage-Example.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "RemoteImage-Example.entitlements"; sourceTree = ""; }; + B966957F2300A03C00D249D3 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; + B966959A2301505B00D249D3 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; + B966959B2301516200D249D3 /* RemoteImage.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = RemoteImage.gif; sourceTree = ""; }; + B9A1EC5C2804B2DC00810D18 /* RemoteImage */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = RemoteImage; path = ..; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + B944332E24D8A503000A7914 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + B944334C24D8A61F000A7914 /* RemoteImage in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + B944332924D8A502000A7914 /* Shared */ = { + isa = PBXGroup; + children = ( + B966957F2300A03C00D249D3 /* ContentView.swift */, + B944332A24D8A503000A7914 /* RemoteImage_ExampleApp.swift */, + B944332C24D8A503000A7914 /* Assets.xcassets */, + ); + path = Shared; + sourceTree = ""; + }; + B944333224D8A503000A7914 /* iOS */ = { + isa = PBXGroup; + children = ( + B944333324D8A503000A7914 /* Info.plist */, + ); + path = iOS; + sourceTree = ""; + }; + B944334A24D8A61F000A7914 /* Frameworks */ = { + isa = PBXGroup; + children = ( + ); + name = Frameworks; + sourceTree = ""; + }; + B966956F2300A03C00D249D3 = { + isa = PBXGroup; + children = ( + B9A1EC5C2804B2DC00810D18 /* RemoteImage */, + B944335124D8A8C7000A7914 /* RemoteImage-Example.entitlements */, + B966959A2301505B00D249D3 /* README.md */, + B966959B2301516200D249D3 /* RemoteImage.gif */, + B944332924D8A502000A7914 /* Shared */, + B944333224D8A503000A7914 /* iOS */, + B96695792300A03C00D249D3 /* Products */, + B944334A24D8A61F000A7914 /* Frameworks */, + ); + sourceTree = ""; + }; + B96695792300A03C00D249D3 /* Products */ = { + isa = PBXGroup; + children = ( + B944333124D8A503000A7914 /* RemoteImage-Example.app */, + ); + name = Products; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + B944333024D8A503000A7914 /* RemoteImage-Example (iOS) */ = { + isa = PBXNativeTarget; + buildConfigurationList = B944334224D8A503000A7914 /* Build configuration list for PBXNativeTarget "RemoteImage-Example (iOS)" */; + buildPhases = ( + B944332D24D8A503000A7914 /* Sources */, + B944332E24D8A503000A7914 /* Frameworks */, + B944332F24D8A503000A7914 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "RemoteImage-Example (iOS)"; + packageProductDependencies = ( + B944334B24D8A61F000A7914 /* RemoteImage */, + ); + productName = "RemoteImage-Example (iOS)"; + productReference = B944333124D8A503000A7914 /* RemoteImage-Example.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + B96695702300A03C00D249D3 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 1200; + LastUpgradeCheck = 1100; + ORGANIZATIONNAME = "Christian Elies"; + TargetAttributes = { + B944333024D8A503000A7914 = { + CreatedOnToolsVersion = 12.0; + }; + }; + }; + buildConfigurationList = B96695732300A03C00D249D3 /* Build configuration list for PBXProject "RemoteImage-Example" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = B966956F2300A03C00D249D3; + packageReferences = ( + B9B7E17D2304BA340018BD33 /* XCRemoteSwiftPackageReference "RemoteImage" */, + ); + productRefGroup = B96695792300A03C00D249D3 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + B944333024D8A503000A7914 /* RemoteImage-Example (iOS) */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + B944332F24D8A503000A7914 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + B944334024D8A503000A7914 /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + B944332D24D8A503000A7914 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + B944334824D8A5F9000A7914 /* ContentView.swift in Sources */, + B944333C24D8A503000A7914 /* RemoteImage_ExampleApp.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + B944334324D8A503000A7914 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CODE_SIGN_ENTITLEMENTS = "RemoteImage-Example.entitlements"; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; + CODE_SIGN_STYLE = Manual; + DEVELOPMENT_TEAM = 766K8ALVVD; + ENABLE_PREVIEWS = YES; + INFOPLIST_FILE = iOS/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 14.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "de.crelies.RemoteImage-Example"; + "PRODUCT_BUNDLE_IDENTIFIER[sdk=macosx*]" = ""; + PRODUCT_NAME = "RemoteImage-Example"; + PROVISIONING_PROFILE_SPECIFIER = "match Development de.crelies.*"; + "PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = ""; + SDKROOT = iphoneos; + SUPPORTS_MACCATALYST = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2,6"; + }; + name = Debug; + }; + B944334424D8A503000A7914 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CODE_SIGN_ENTITLEMENTS = "RemoteImage-Example.entitlements"; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; + CODE_SIGN_STYLE = Manual; + DEVELOPMENT_TEAM = 766K8ALVVD; + ENABLE_PREVIEWS = YES; + INFOPLIST_FILE = iOS/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 14.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "de.crelies.RemoteImage-Example"; + "PRODUCT_BUNDLE_IDENTIFIER[sdk=macosx*]" = ""; + PRODUCT_NAME = "RemoteImage-Example"; + PROVISIONING_PROFILE_SPECIFIER = "match Development de.crelies.*"; + "PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = ""; + SDKROOT = iphoneos; + SUPPORTS_MACCATALYST = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2,6"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + B966958A2300A03F00D249D3 /* 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++14"; + CLANG_CXX_LIBRARY = "libc++"; + 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_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 = 13.0; + 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; + }; + B966958B2300A03F00D249D3 /* 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++14"; + CLANG_CXX_LIBRARY = "libc++"; + 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_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 = 13.0; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + B944334224D8A503000A7914 /* Build configuration list for PBXNativeTarget "RemoteImage-Example (iOS)" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + B944334324D8A503000A7914 /* Debug */, + B944334424D8A503000A7914 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + B96695732300A03C00D249D3 /* Build configuration list for PBXProject "RemoteImage-Example" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + B966958A2300A03F00D249D3 /* Debug */, + B966958B2300A03F00D249D3 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + +/* Begin XCRemoteSwiftPackageReference section */ + B9B7E17D2304BA340018BD33 /* XCRemoteSwiftPackageReference "RemoteImage" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/crelies/RemoteImage"; + requirement = { + kind = upToNextMajorVersion; + minimumVersion = 2.0.0; + }; + }; +/* End XCRemoteSwiftPackageReference section */ + +/* Begin XCSwiftPackageProductDependency section */ + B944334B24D8A61F000A7914 /* RemoteImage */ = { + isa = XCSwiftPackageProductDependency; + package = B9B7E17D2304BA340018BD33 /* XCRemoteSwiftPackageReference "RemoteImage" */; + productName = RemoteImage; + }; +/* End XCSwiftPackageProductDependency section */ + }; + rootObject = B96695702300A03C00D249D3 /* Project object */; +} diff --git a/Example/RemoteImage-Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Example/RemoteImage-Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/Example/RemoteImage-Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Example/RemoteImage-Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Example/RemoteImage-Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/Example/RemoteImage-Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Example/RemoteImage-Example.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Example/RemoteImage-Example.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved new file mode 100644 index 0000000..221a24a --- /dev/null +++ b/Example/RemoteImage-Example.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -0,0 +1,25 @@ +{ + "object": { + "pins": [ + { + "package": "RemoteImage", + "repositoryURL": "https://github.com/crelies/RemoteImage", + "state": { + "branch": null, + "revision": "2dca7774a57eaa0797cf288a98bf6ea516469b49", + "version": "2.0.3" + } + }, + { + "package": "ViewInspector", + "repositoryURL": "https://github.com/nalexn/ViewInspector.git", + "state": { + "branch": null, + "revision": "fe3b59dac12a7ccff8e8fed502acea9762a880a1", + "version": "0.4.3" + } + } + ] + }, + "version": 1 +} diff --git a/Example/RemoteImage.gif b/Example/RemoteImage.gif new file mode 100644 index 0000000..3d000c7 Binary files /dev/null and b/Example/RemoteImage.gif differ diff --git a/Example/Shared/Assets.xcassets/AccentColor.colorset/Contents.json b/Example/Shared/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 0000000..eb87897 --- /dev/null +++ b/Example/Shared/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example/Shared/Assets.xcassets/AppIcon.appiconset/Contents.json b/Example/Shared/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..c136eaf --- /dev/null +++ b/Example/Shared/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,148 @@ +{ + "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" : "1x", + "size" : "76x76" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "76x76" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "83.5x83.5" + }, + { + "idiom" : "ios-marketing", + "scale" : "1x", + "size" : "1024x1024" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "16x16" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "16x16" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "32x32" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "32x32" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "128x128" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "128x128" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "256x256" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "256x256" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "512x512" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "512x512" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example/Shared/Assets.xcassets/Contents.json b/Example/Shared/Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/Example/Shared/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example/Shared/ContentView.swift b/Example/Shared/ContentView.swift new file mode 100644 index 0000000..39e6824 --- /dev/null +++ b/Example/Shared/ContentView.swift @@ -0,0 +1,34 @@ +// +// ContentView.swift +// RemoteImage +// +// Created by Christian Elies on 11.08.19. +// Copyright © 2019 Christian Elies. All rights reserved. +// + +import RemoteImage +import SwiftUI + +struct ContentView: View { + private let url = URL(string: "https://images.unsplash.com/photo-1524419986249-348e8fa6ad4a?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1950&q=80")! + + var body: some View { + RemoteImage(type: ./service/https://github.com/url(url), errorView: { error in + Text(error.localizedDescription) + }, imageView: { image in + image + .resizable() + .aspectRatio(contentMode: .fit) + }, loadingView: { + ProgressView() + }) + } +} + +#if DEBUG +struct ContentView_Previews: PreviewProvider { + static var previews: some View { + ContentView() + } +} +#endif diff --git a/Example/Shared/RemoteImage_ExampleApp.swift b/Example/Shared/RemoteImage_ExampleApp.swift new file mode 100644 index 0000000..fb038ff --- /dev/null +++ b/Example/Shared/RemoteImage_ExampleApp.swift @@ -0,0 +1,18 @@ +// +// RemoteImage_ExampleApp.swift +// Shared +// +// Created by Christian Elies on 03.08.20. +// Copyright © 2020 Christian Elies. All rights reserved. +// + +import SwiftUI + +@main +struct RemoteImage_ExampleApp: App { + var body: some Scene { + WindowGroup { + ContentView() + } + } +} diff --git a/Example/iOS/Info.plist b/Example/iOS/Info.plist new file mode 100644 index 0000000..efc211a --- /dev/null +++ b/Example/iOS/Info.plist @@ -0,0 +1,50 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + + UIApplicationSupportsIndirectInputEvents + + UILaunchScreen + + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + +