├── .gitignore ├── GifView_SwiftUI ├── GifView_SwiftUI.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── GifView_SwiftUI │ ├── Assets.xcassets │ ├── AccentColor.colorset │ │ └── Contents.json │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── Contents.json │ ├── ContentView.swift │ ├── GifImage.swift │ ├── GifView_SwiftUIApp.swift │ ├── Info.plist │ ├── Preview Content │ └── Preview Assets.xcassets │ │ └── Contents.json │ └── pokeball.gif ├── README.md └── gif-image.001.jpeg /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## User settings 6 | xcuserdata/ 7 | 8 | ## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) 9 | *.xcscmblueprint 10 | *.xccheckout 11 | 12 | ## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) 13 | build/ 14 | DerivedData/ 15 | *.moved-aside 16 | *.pbxuser 17 | !default.pbxuser 18 | *.mode1v3 19 | !default.mode1v3 20 | *.mode2v3 21 | !default.mode2v3 22 | *.perspectivev3 23 | !default.perspectivev3 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | 28 | ## App packaging 29 | *.ipa 30 | *.dSYM.zip 31 | *.dSYM 32 | 33 | ## Playgrounds 34 | timeline.xctimeline 35 | playground.xcworkspace 36 | 37 | # Swift Package Manager 38 | # 39 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 40 | # Packages/ 41 | # Package.pins 42 | # Package.resolved 43 | # *.xcodeproj 44 | # 45 | # Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata 46 | # hence it is not needed unless you have added a package configuration file to your project 47 | # .swiftpm 48 | 49 | .build/ 50 | 51 | # CocoaPods 52 | # 53 | # We recommend against adding the Pods directory to your .gitignore. However 54 | # you should judge for yourself, the pros and cons are mentioned at: 55 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 56 | # 57 | # Pods/ 58 | # 59 | # Add this line if you want to avoid checking in source code from the Xcode workspace 60 | # *.xcworkspace 61 | 62 | # Carthage 63 | # 64 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 65 | # Carthage/Checkouts 66 | 67 | Carthage/Build/ 68 | 69 | # Accio dependency management 70 | Dependencies/ 71 | .accio/ 72 | 73 | # fastlane 74 | # 75 | # It is recommended to not store the screenshots in the git repo. 76 | # Instead, use fastlane to re-generate the screenshots whenever they are needed. 77 | # For more information about the recommended setup visit: 78 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 79 | 80 | fastlane/report.xml 81 | fastlane/Preview.html 82 | fastlane/screenshots/**/*.png 83 | fastlane/test_output 84 | 85 | # Code Injection 86 | # 87 | # After new code Injection tools there's a generated folder /iOSInjectionProject 88 | # https://github.com/johnno1962/injectionforxcode 89 | 90 | iOSInjectionProject/ 91 | -------------------------------------------------------------------------------- /GifView_SwiftUI/GifView_SwiftUI.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | B501E39426CA9A4F00E25D4F /* GifView_SwiftUIApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = B501E39326CA9A4F00E25D4F /* GifView_SwiftUIApp.swift */; }; 11 | B501E39626CA9A4F00E25D4F /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B501E39526CA9A4F00E25D4F /* ContentView.swift */; }; 12 | B501E39826CA9A5200E25D4F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B501E39726CA9A5200E25D4F /* Assets.xcassets */; }; 13 | B501E39B26CA9A5200E25D4F /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B501E39A26CA9A5200E25D4F /* Preview Assets.xcassets */; }; 14 | B55E022D26CA9D9600DF5F11 /* pokeball.gif in Resources */ = {isa = PBXBuildFile; fileRef = B55E022C26CA9D9600DF5F11 /* pokeball.gif */; }; 15 | B5D9C0CA26CA9E2500DB230A /* GifImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5D9C0C926CA9E2500DB230A /* GifImage.swift */; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXFileReference section */ 19 | B501E39026CA9A4E00E25D4F /* GifView_SwiftUI.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = GifView_SwiftUI.app; sourceTree = BUILT_PRODUCTS_DIR; }; 20 | B501E39326CA9A4F00E25D4F /* GifView_SwiftUIApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GifView_SwiftUIApp.swift; sourceTree = ""; }; 21 | B501E39526CA9A4F00E25D4F /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; 22 | B501E39726CA9A5200E25D4F /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 23 | B501E39A26CA9A5200E25D4F /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; 24 | B501E39C26CA9A5200E25D4F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 25 | B55E022C26CA9D9600DF5F11 /* pokeball.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = pokeball.gif; sourceTree = ""; }; 26 | B5D9C0C926CA9E2500DB230A /* GifImage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GifImage.swift; sourceTree = ""; }; 27 | /* End PBXFileReference section */ 28 | 29 | /* Begin PBXFrameworksBuildPhase section */ 30 | B501E38D26CA9A4E00E25D4F /* Frameworks */ = { 31 | isa = PBXFrameworksBuildPhase; 32 | buildActionMask = 2147483647; 33 | files = ( 34 | ); 35 | runOnlyForDeploymentPostprocessing = 0; 36 | }; 37 | /* End PBXFrameworksBuildPhase section */ 38 | 39 | /* Begin PBXGroup section */ 40 | B501E38726CA9A4E00E25D4F = { 41 | isa = PBXGroup; 42 | children = ( 43 | B501E39226CA9A4E00E25D4F /* GifView_SwiftUI */, 44 | B501E39126CA9A4E00E25D4F /* Products */, 45 | ); 46 | sourceTree = ""; 47 | }; 48 | B501E39126CA9A4E00E25D4F /* Products */ = { 49 | isa = PBXGroup; 50 | children = ( 51 | B501E39026CA9A4E00E25D4F /* GifView_SwiftUI.app */, 52 | ); 53 | name = Products; 54 | sourceTree = ""; 55 | }; 56 | B501E39226CA9A4E00E25D4F /* GifView_SwiftUI */ = { 57 | isa = PBXGroup; 58 | children = ( 59 | B5D9C0C926CA9E2500DB230A /* GifImage.swift */, 60 | B55E022C26CA9D9600DF5F11 /* pokeball.gif */, 61 | B501E39326CA9A4F00E25D4F /* GifView_SwiftUIApp.swift */, 62 | B501E39526CA9A4F00E25D4F /* ContentView.swift */, 63 | B501E39726CA9A5200E25D4F /* Assets.xcassets */, 64 | B501E39C26CA9A5200E25D4F /* Info.plist */, 65 | B501E39926CA9A5200E25D4F /* Preview Content */, 66 | ); 67 | path = GifView_SwiftUI; 68 | sourceTree = ""; 69 | }; 70 | B501E39926CA9A5200E25D4F /* Preview Content */ = { 71 | isa = PBXGroup; 72 | children = ( 73 | B501E39A26CA9A5200E25D4F /* Preview Assets.xcassets */, 74 | ); 75 | path = "Preview Content"; 76 | sourceTree = ""; 77 | }; 78 | /* End PBXGroup section */ 79 | 80 | /* Begin PBXNativeTarget section */ 81 | B501E38F26CA9A4E00E25D4F /* GifView_SwiftUI */ = { 82 | isa = PBXNativeTarget; 83 | buildConfigurationList = B501E39F26CA9A5200E25D4F /* Build configuration list for PBXNativeTarget "GifView_SwiftUI" */; 84 | buildPhases = ( 85 | B501E38C26CA9A4E00E25D4F /* Sources */, 86 | B501E38D26CA9A4E00E25D4F /* Frameworks */, 87 | B501E38E26CA9A4E00E25D4F /* Resources */, 88 | ); 89 | buildRules = ( 90 | ); 91 | dependencies = ( 92 | ); 93 | name = GifView_SwiftUI; 94 | productName = GifView_SwiftUI; 95 | productReference = B501E39026CA9A4E00E25D4F /* GifView_SwiftUI.app */; 96 | productType = "com.apple.product-type.application"; 97 | }; 98 | /* End PBXNativeTarget section */ 99 | 100 | /* Begin PBXProject section */ 101 | B501E38826CA9A4E00E25D4F /* Project object */ = { 102 | isa = PBXProject; 103 | attributes = { 104 | LastSwiftUpdateCheck = 1250; 105 | LastUpgradeCheck = 1250; 106 | TargetAttributes = { 107 | B501E38F26CA9A4E00E25D4F = { 108 | CreatedOnToolsVersion = 12.5; 109 | }; 110 | }; 111 | }; 112 | buildConfigurationList = B501E38B26CA9A4E00E25D4F /* Build configuration list for PBXProject "GifView_SwiftUI" */; 113 | compatibilityVersion = "Xcode 9.3"; 114 | developmentRegion = en; 115 | hasScannedForEncodings = 0; 116 | knownRegions = ( 117 | en, 118 | Base, 119 | ); 120 | mainGroup = B501E38726CA9A4E00E25D4F; 121 | productRefGroup = B501E39126CA9A4E00E25D4F /* Products */; 122 | projectDirPath = ""; 123 | projectRoot = ""; 124 | targets = ( 125 | B501E38F26CA9A4E00E25D4F /* GifView_SwiftUI */, 126 | ); 127 | }; 128 | /* End PBXProject section */ 129 | 130 | /* Begin PBXResourcesBuildPhase section */ 131 | B501E38E26CA9A4E00E25D4F /* Resources */ = { 132 | isa = PBXResourcesBuildPhase; 133 | buildActionMask = 2147483647; 134 | files = ( 135 | B55E022D26CA9D9600DF5F11 /* pokeball.gif in Resources */, 136 | B501E39B26CA9A5200E25D4F /* Preview Assets.xcassets in Resources */, 137 | B501E39826CA9A5200E25D4F /* Assets.xcassets in Resources */, 138 | ); 139 | runOnlyForDeploymentPostprocessing = 0; 140 | }; 141 | /* End PBXResourcesBuildPhase section */ 142 | 143 | /* Begin PBXSourcesBuildPhase section */ 144 | B501E38C26CA9A4E00E25D4F /* Sources */ = { 145 | isa = PBXSourcesBuildPhase; 146 | buildActionMask = 2147483647; 147 | files = ( 148 | B501E39626CA9A4F00E25D4F /* ContentView.swift in Sources */, 149 | B5D9C0CA26CA9E2500DB230A /* GifImage.swift in Sources */, 150 | B501E39426CA9A4F00E25D4F /* GifView_SwiftUIApp.swift in Sources */, 151 | ); 152 | runOnlyForDeploymentPostprocessing = 0; 153 | }; 154 | /* End PBXSourcesBuildPhase section */ 155 | 156 | /* Begin XCBuildConfiguration section */ 157 | B501E39D26CA9A5200E25D4F /* Debug */ = { 158 | isa = XCBuildConfiguration; 159 | buildSettings = { 160 | ALWAYS_SEARCH_USER_PATHS = NO; 161 | CLANG_ANALYZER_NONNULL = YES; 162 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 163 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 164 | CLANG_CXX_LIBRARY = "libc++"; 165 | CLANG_ENABLE_MODULES = YES; 166 | CLANG_ENABLE_OBJC_ARC = YES; 167 | CLANG_ENABLE_OBJC_WEAK = YES; 168 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 169 | CLANG_WARN_BOOL_CONVERSION = YES; 170 | CLANG_WARN_COMMA = YES; 171 | CLANG_WARN_CONSTANT_CONVERSION = YES; 172 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 173 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 174 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 175 | CLANG_WARN_EMPTY_BODY = YES; 176 | CLANG_WARN_ENUM_CONVERSION = YES; 177 | CLANG_WARN_INFINITE_RECURSION = YES; 178 | CLANG_WARN_INT_CONVERSION = YES; 179 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 180 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 181 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 182 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 183 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 184 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 185 | CLANG_WARN_STRICT_PROTOTYPES = YES; 186 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 187 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 188 | CLANG_WARN_UNREACHABLE_CODE = YES; 189 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 190 | COPY_PHASE_STRIP = NO; 191 | DEBUG_INFORMATION_FORMAT = dwarf; 192 | ENABLE_STRICT_OBJC_MSGSEND = YES; 193 | ENABLE_TESTABILITY = YES; 194 | GCC_C_LANGUAGE_STANDARD = gnu11; 195 | GCC_DYNAMIC_NO_PIC = NO; 196 | GCC_NO_COMMON_BLOCKS = YES; 197 | GCC_OPTIMIZATION_LEVEL = 0; 198 | GCC_PREPROCESSOR_DEFINITIONS = ( 199 | "DEBUG=1", 200 | "$(inherited)", 201 | ); 202 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 203 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 204 | GCC_WARN_UNDECLARED_SELECTOR = YES; 205 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 206 | GCC_WARN_UNUSED_FUNCTION = YES; 207 | GCC_WARN_UNUSED_VARIABLE = YES; 208 | IPHONEOS_DEPLOYMENT_TARGET = 14.5; 209 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 210 | MTL_FAST_MATH = YES; 211 | ONLY_ACTIVE_ARCH = YES; 212 | SDKROOT = iphoneos; 213 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 214 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 215 | }; 216 | name = Debug; 217 | }; 218 | B501E39E26CA9A5200E25D4F /* Release */ = { 219 | isa = XCBuildConfiguration; 220 | buildSettings = { 221 | ALWAYS_SEARCH_USER_PATHS = NO; 222 | CLANG_ANALYZER_NONNULL = YES; 223 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 224 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 225 | CLANG_CXX_LIBRARY = "libc++"; 226 | CLANG_ENABLE_MODULES = YES; 227 | CLANG_ENABLE_OBJC_ARC = YES; 228 | CLANG_ENABLE_OBJC_WEAK = YES; 229 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 230 | CLANG_WARN_BOOL_CONVERSION = YES; 231 | CLANG_WARN_COMMA = YES; 232 | CLANG_WARN_CONSTANT_CONVERSION = YES; 233 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 234 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 235 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 236 | CLANG_WARN_EMPTY_BODY = YES; 237 | CLANG_WARN_ENUM_CONVERSION = YES; 238 | CLANG_WARN_INFINITE_RECURSION = YES; 239 | CLANG_WARN_INT_CONVERSION = YES; 240 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 241 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 242 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 243 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 244 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 245 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 246 | CLANG_WARN_STRICT_PROTOTYPES = YES; 247 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 248 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 249 | CLANG_WARN_UNREACHABLE_CODE = YES; 250 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 251 | COPY_PHASE_STRIP = NO; 252 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 253 | ENABLE_NS_ASSERTIONS = NO; 254 | ENABLE_STRICT_OBJC_MSGSEND = YES; 255 | GCC_C_LANGUAGE_STANDARD = gnu11; 256 | GCC_NO_COMMON_BLOCKS = YES; 257 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 258 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 259 | GCC_WARN_UNDECLARED_SELECTOR = YES; 260 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 261 | GCC_WARN_UNUSED_FUNCTION = YES; 262 | GCC_WARN_UNUSED_VARIABLE = YES; 263 | IPHONEOS_DEPLOYMENT_TARGET = 14.5; 264 | MTL_ENABLE_DEBUG_INFO = NO; 265 | MTL_FAST_MATH = YES; 266 | SDKROOT = iphoneos; 267 | SWIFT_COMPILATION_MODE = wholemodule; 268 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 269 | VALIDATE_PRODUCT = YES; 270 | }; 271 | name = Release; 272 | }; 273 | B501E3A026CA9A5200E25D4F /* Debug */ = { 274 | isa = XCBuildConfiguration; 275 | buildSettings = { 276 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 277 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 278 | CODE_SIGN_STYLE = Automatic; 279 | DEVELOPMENT_ASSET_PATHS = "\"GifView_SwiftUI/Preview Content\""; 280 | ENABLE_PREVIEWS = YES; 281 | INFOPLIST_FILE = GifView_SwiftUI/Info.plist; 282 | IPHONEOS_DEPLOYMENT_TARGET = 14.0; 283 | LD_RUNPATH_SEARCH_PATHS = ( 284 | "$(inherited)", 285 | "@executable_path/Frameworks", 286 | ); 287 | PRODUCT_BUNDLE_IDENTIFIER = "com.swiftandtips.GifView-SwiftUI"; 288 | PRODUCT_NAME = "$(TARGET_NAME)"; 289 | SWIFT_VERSION = 5.0; 290 | TARGETED_DEVICE_FAMILY = "1,2"; 291 | }; 292 | name = Debug; 293 | }; 294 | B501E3A126CA9A5200E25D4F /* Release */ = { 295 | isa = XCBuildConfiguration; 296 | buildSettings = { 297 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 298 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 299 | CODE_SIGN_STYLE = Automatic; 300 | DEVELOPMENT_ASSET_PATHS = "\"GifView_SwiftUI/Preview Content\""; 301 | ENABLE_PREVIEWS = YES; 302 | INFOPLIST_FILE = GifView_SwiftUI/Info.plist; 303 | IPHONEOS_DEPLOYMENT_TARGET = 14.0; 304 | LD_RUNPATH_SEARCH_PATHS = ( 305 | "$(inherited)", 306 | "@executable_path/Frameworks", 307 | ); 308 | PRODUCT_BUNDLE_IDENTIFIER = "com.swiftandtips.GifView-SwiftUI"; 309 | PRODUCT_NAME = "$(TARGET_NAME)"; 310 | SWIFT_VERSION = 5.0; 311 | TARGETED_DEVICE_FAMILY = "1,2"; 312 | }; 313 | name = Release; 314 | }; 315 | /* End XCBuildConfiguration section */ 316 | 317 | /* Begin XCConfigurationList section */ 318 | B501E38B26CA9A4E00E25D4F /* Build configuration list for PBXProject "GifView_SwiftUI" */ = { 319 | isa = XCConfigurationList; 320 | buildConfigurations = ( 321 | B501E39D26CA9A5200E25D4F /* Debug */, 322 | B501E39E26CA9A5200E25D4F /* Release */, 323 | ); 324 | defaultConfigurationIsVisible = 0; 325 | defaultConfigurationName = Release; 326 | }; 327 | B501E39F26CA9A5200E25D4F /* Build configuration list for PBXNativeTarget "GifView_SwiftUI" */ = { 328 | isa = XCConfigurationList; 329 | buildConfigurations = ( 330 | B501E3A026CA9A5200E25D4F /* Debug */, 331 | B501E3A126CA9A5200E25D4F /* Release */, 332 | ); 333 | defaultConfigurationIsVisible = 0; 334 | defaultConfigurationName = Release; 335 | }; 336 | /* End XCConfigurationList section */ 337 | }; 338 | rootObject = B501E38826CA9A4E00E25D4F /* Project object */; 339 | } 340 | -------------------------------------------------------------------------------- /GifView_SwiftUI/GifView_SwiftUI.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /GifView_SwiftUI/GifView_SwiftUI.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /GifView_SwiftUI/GifView_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 | -------------------------------------------------------------------------------- /GifView_SwiftUI/GifView_SwiftUI/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "scale" : "2x", 6 | "size" : "20x20" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "scale" : "3x", 11 | "size" : "20x20" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "scale" : "2x", 16 | "size" : "29x29" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "scale" : "3x", 21 | "size" : "29x29" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "scale" : "2x", 26 | "size" : "40x40" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "scale" : "3x", 31 | "size" : "40x40" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "scale" : "2x", 36 | "size" : "60x60" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "scale" : "3x", 41 | "size" : "60x60" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "scale" : "1x", 46 | "size" : "20x20" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "scale" : "2x", 51 | "size" : "20x20" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "scale" : "1x", 56 | "size" : "29x29" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "scale" : "2x", 61 | "size" : "29x29" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "scale" : "1x", 66 | "size" : "40x40" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "scale" : "2x", 71 | "size" : "40x40" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "scale" : "1x", 76 | "size" : "76x76" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "scale" : "2x", 81 | "size" : "76x76" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "scale" : "2x", 86 | "size" : "83.5x83.5" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "scale" : "1x", 91 | "size" : "1024x1024" 92 | } 93 | ], 94 | "info" : { 95 | "author" : "xcode", 96 | "version" : 1 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /GifView_SwiftUI/GifView_SwiftUI/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /GifView_SwiftUI/GifView_SwiftUI/ContentView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ContentView.swift 3 | // GifView_SwiftUI 4 | // 5 | // Created by Pedro Rojas on 16/08/21. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct ContentView: View { 11 | var body: some View { 12 | List(0..<10) { item in 13 | GifImage("pokeball") 14 | .frame(width: 200, height: 200) 15 | 16 | } 17 | } 18 | } 19 | 20 | struct ContentView_Previews: PreviewProvider { 21 | static var previews: some View { 22 | ContentView() 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /GifView_SwiftUI/GifView_SwiftUI/GifImage.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GifView.swift 3 | // GifView_SwiftUI 4 | // 5 | // Created by Pedro Rojas on 16/08/21. 6 | // 7 | 8 | import SwiftUI 9 | import WebKit 10 | 11 | struct GifImage: UIViewRepresentable { 12 | private let name: String 13 | 14 | init(_ name: String) { 15 | self.name = name 16 | } 17 | 18 | func makeUIView(context: Context) -> WKWebView { 19 | let webView = WKWebView() 20 | let url = Bundle.main.url(forResource: name, withExtension: "gif")! 21 | let data = try! Data(contentsOf: url) 22 | webView.load( 23 | data, 24 | mimeType: "image/gif", 25 | characterEncodingName: "UTF-8", 26 | baseURL: url.deletingLastPathComponent() 27 | ) 28 | webView.scrollView.isScrollEnabled = false 29 | 30 | return webView 31 | } 32 | 33 | func updateUIView(_ uiView: WKWebView, context: Context) { 34 | uiView.reload() 35 | } 36 | 37 | } 38 | 39 | 40 | struct GifImage_Previews: PreviewProvider { 41 | static var previews: some View { 42 | GifImage("pokeball") 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /GifView_SwiftUI/GifView_SwiftUI/GifView_SwiftUIApp.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GifView_SwiftUIApp.swift 3 | // GifView_SwiftUI 4 | // 5 | // Created by Pedro Rojas on 16/08/21. 6 | // 7 | 8 | import SwiftUI 9 | 10 | @main 11 | struct GifView_SwiftUIApp: App { 12 | var body: some Scene { 13 | WindowGroup { 14 | ContentView() 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /GifView_SwiftUI/GifView_SwiftUI/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UIApplicationSceneManifest 24 | 25 | UIApplicationSupportsMultipleScenes 26 | 27 | 28 | UIApplicationSupportsIndirectInputEvents 29 | 30 | UILaunchScreen 31 | 32 | UIRequiredDeviceCapabilities 33 | 34 | armv7 35 | 36 | UISupportedInterfaceOrientations 37 | 38 | UIInterfaceOrientationPortrait 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UISupportedInterfaceOrientations~ipad 43 | 44 | UIInterfaceOrientationPortrait 45 | UIInterfaceOrientationPortraitUpsideDown 46 | UIInterfaceOrientationLandscapeLeft 47 | UIInterfaceOrientationLandscapeRight 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /GifView_SwiftUI/GifView_SwiftUI/Preview Content/Preview Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /GifView_SwiftUI/GifView_SwiftUI/pokeball.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pitt500/GifView-SwiftUI/7e651d8099ac305d22964d3c818a275fd1724fc9/GifView_SwiftUI/GifView_SwiftUI/pokeball.gif -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # This is what you need to display a gif in SwiftUI 💡! 2 | This a demo made for [Swift && Tips](https://www.youtube.com/c/SwiftandTips) 3 | 4 | [Link to the video](https://youtu.be/9fz8EW-dX-I) 5 | ![Gifs in SwiftUI!](/gif-image.001.jpeg) 6 | 7 | I got so much fun doing this video! Let's see how can we display a gif image in SwiftUI. There's no official support for that, but we have a quick solution to solve this problem. Enjoy! 8 | 9 | ## Requirements 10 | - Xcode 12+ 11 | - iOS 14+ 12 | - Swift 5.3+ 13 | 14 | 15 | [My Twitter](https://twitter.com/swiftandtips) 16 | 17 | 18 | -------------------------------------------------------------------------------- /gif-image.001.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pitt500/GifView-SwiftUI/7e651d8099ac305d22964d3c818a275fd1724fc9/gif-image.001.jpeg --------------------------------------------------------------------------------