├── .DS_Store ├── LegoAnimation.gif ├── README.md ├── lego.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ └── xcuserdata │ │ └── shivamvijaywargiya.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── shivamvijaywargiya.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist ├── lego ├── Assets.xcassets │ ├── AccentColor.colorset │ │ └── Contents.json │ ├── AppIcon.appiconset │ │ └── Contents.json │ ├── Contents.json │ └── cube.imageset │ │ ├── Contents.json │ │ └── icons8-sugar-cube-100.png ├── ContentView.swift ├── Info.plist ├── LegoBlock.swift ├── LegoSet.swift ├── Preview Content │ └── Preview Assets.xcassets │ │ └── Contents.json └── legoApp.swift ├── legoTests ├── Info.plist └── legoTests.swift └── legoUITests ├── Info.plist └── legoUITests.swift /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vijaywargiya/LegoLoadingAnimation-SwiftUI/566affa2417b3d1b2b091e0518284e354dfb0693/.DS_Store -------------------------------------------------------------------------------- /LegoAnimation.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vijaywargiya/LegoLoadingAnimation-SwiftUI/566affa2417b3d1b2b091e0518284e354dfb0693/LegoAnimation.gif -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LegoLoadingAnimation-SwiftUI 2 | 3 | 4 | ### Head over to [the creative developer](https://thecreativedeveloper.substack.com) to read about this project. 5 | 6 | ![animation](https://github.com/vijaywargiya/LegoLoadingAnimation-SwiftUI/blob/main/LegoAnimation.gif) 7 | -------------------------------------------------------------------------------- /lego.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | DC40DBFE24C1987300557431 /* legoApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC40DBFD24C1987300557431 /* legoApp.swift */; }; 11 | DC40DC0024C1987300557431 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC40DBFF24C1987300557431 /* ContentView.swift */; }; 12 | DC40DC0224C1987400557431 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DC40DC0124C1987400557431 /* Assets.xcassets */; }; 13 | DC40DC0524C1987400557431 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DC40DC0424C1987400557431 /* Preview Assets.xcassets */; }; 14 | DC40DC1024C1987400557431 /* legoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC40DC0F24C1987400557431 /* legoTests.swift */; }; 15 | DC40DC1B24C1987400557431 /* legoUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC40DC1A24C1987400557431 /* legoUITests.swift */; }; 16 | DCC55F9E24C559C400994069 /* LegoBlock.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCC55F9D24C559C400994069 /* LegoBlock.swift */; }; 17 | DCC55FA024C55A0900994069 /* LegoSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCC55F9F24C55A0900994069 /* LegoSet.swift */; }; 18 | DCC55FA224C57B4000994069 /* LegoAnimation.gif in Resources */ = {isa = PBXBuildFile; fileRef = DCC55FA124C57B4000994069 /* LegoAnimation.gif */; }; 19 | /* End PBXBuildFile section */ 20 | 21 | /* Begin PBXContainerItemProxy section */ 22 | DC40DC0C24C1987400557431 /* PBXContainerItemProxy */ = { 23 | isa = PBXContainerItemProxy; 24 | containerPortal = DC40DBF224C1987300557431 /* Project object */; 25 | proxyType = 1; 26 | remoteGlobalIDString = DC40DBF924C1987300557431; 27 | remoteInfo = lego; 28 | }; 29 | DC40DC1724C1987400557431 /* PBXContainerItemProxy */ = { 30 | isa = PBXContainerItemProxy; 31 | containerPortal = DC40DBF224C1987300557431 /* Project object */; 32 | proxyType = 1; 33 | remoteGlobalIDString = DC40DBF924C1987300557431; 34 | remoteInfo = lego; 35 | }; 36 | /* End PBXContainerItemProxy section */ 37 | 38 | /* Begin PBXFileReference section */ 39 | DC40DBFA24C1987300557431 /* lego.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = lego.app; sourceTree = BUILT_PRODUCTS_DIR; }; 40 | DC40DBFD24C1987300557431 /* legoApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = legoApp.swift; sourceTree = ""; }; 41 | DC40DBFF24C1987300557431 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; 42 | DC40DC0124C1987400557431 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 43 | DC40DC0424C1987400557431 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; 44 | DC40DC0624C1987400557431 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 45 | DC40DC0B24C1987400557431 /* legoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = legoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 46 | DC40DC0F24C1987400557431 /* legoTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = legoTests.swift; sourceTree = ""; }; 47 | DC40DC1124C1987400557431 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 48 | DC40DC1624C1987400557431 /* legoUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = legoUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 49 | DC40DC1A24C1987400557431 /* legoUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = legoUITests.swift; sourceTree = ""; }; 50 | DC40DC1C24C1987400557431 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 51 | DCC55F9D24C559C400994069 /* LegoBlock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LegoBlock.swift; sourceTree = ""; }; 52 | DCC55F9F24C55A0900994069 /* LegoSet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LegoSet.swift; sourceTree = ""; }; 53 | DCC55FA124C57B4000994069 /* LegoAnimation.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = LegoAnimation.gif; sourceTree = ""; }; 54 | /* End PBXFileReference section */ 55 | 56 | /* Begin PBXFrameworksBuildPhase section */ 57 | DC40DBF724C1987300557431 /* Frameworks */ = { 58 | isa = PBXFrameworksBuildPhase; 59 | buildActionMask = 2147483647; 60 | files = ( 61 | ); 62 | runOnlyForDeploymentPostprocessing = 0; 63 | }; 64 | DC40DC0824C1987400557431 /* Frameworks */ = { 65 | isa = PBXFrameworksBuildPhase; 66 | buildActionMask = 2147483647; 67 | files = ( 68 | ); 69 | runOnlyForDeploymentPostprocessing = 0; 70 | }; 71 | DC40DC1324C1987400557431 /* Frameworks */ = { 72 | isa = PBXFrameworksBuildPhase; 73 | buildActionMask = 2147483647; 74 | files = ( 75 | ); 76 | runOnlyForDeploymentPostprocessing = 0; 77 | }; 78 | /* End PBXFrameworksBuildPhase section */ 79 | 80 | /* Begin PBXGroup section */ 81 | DC40DBF124C1987300557431 = { 82 | isa = PBXGroup; 83 | children = ( 84 | DCC55FA124C57B4000994069 /* LegoAnimation.gif */, 85 | DC40DBFC24C1987300557431 /* lego */, 86 | DC40DC0E24C1987400557431 /* legoTests */, 87 | DC40DC1924C1987400557431 /* legoUITests */, 88 | DC40DBFB24C1987300557431 /* Products */, 89 | ); 90 | sourceTree = ""; 91 | }; 92 | DC40DBFB24C1987300557431 /* Products */ = { 93 | isa = PBXGroup; 94 | children = ( 95 | DC40DBFA24C1987300557431 /* lego.app */, 96 | DC40DC0B24C1987400557431 /* legoTests.xctest */, 97 | DC40DC1624C1987400557431 /* legoUITests.xctest */, 98 | ); 99 | name = Products; 100 | sourceTree = ""; 101 | }; 102 | DC40DBFC24C1987300557431 /* lego */ = { 103 | isa = PBXGroup; 104 | children = ( 105 | DC40DBFD24C1987300557431 /* legoApp.swift */, 106 | DC40DBFF24C1987300557431 /* ContentView.swift */, 107 | DC40DC0124C1987400557431 /* Assets.xcassets */, 108 | DC40DC0624C1987400557431 /* Info.plist */, 109 | DC40DC0324C1987400557431 /* Preview Content */, 110 | DCC55F9D24C559C400994069 /* LegoBlock.swift */, 111 | DCC55F9F24C55A0900994069 /* LegoSet.swift */, 112 | ); 113 | path = lego; 114 | sourceTree = ""; 115 | }; 116 | DC40DC0324C1987400557431 /* Preview Content */ = { 117 | isa = PBXGroup; 118 | children = ( 119 | DC40DC0424C1987400557431 /* Preview Assets.xcassets */, 120 | ); 121 | path = "Preview Content"; 122 | sourceTree = ""; 123 | }; 124 | DC40DC0E24C1987400557431 /* legoTests */ = { 125 | isa = PBXGroup; 126 | children = ( 127 | DC40DC0F24C1987400557431 /* legoTests.swift */, 128 | DC40DC1124C1987400557431 /* Info.plist */, 129 | ); 130 | path = legoTests; 131 | sourceTree = ""; 132 | }; 133 | DC40DC1924C1987400557431 /* legoUITests */ = { 134 | isa = PBXGroup; 135 | children = ( 136 | DC40DC1A24C1987400557431 /* legoUITests.swift */, 137 | DC40DC1C24C1987400557431 /* Info.plist */, 138 | ); 139 | path = legoUITests; 140 | sourceTree = ""; 141 | }; 142 | /* End PBXGroup section */ 143 | 144 | /* Begin PBXNativeTarget section */ 145 | DC40DBF924C1987300557431 /* lego */ = { 146 | isa = PBXNativeTarget; 147 | buildConfigurationList = DC40DC1F24C1987400557431 /* Build configuration list for PBXNativeTarget "lego" */; 148 | buildPhases = ( 149 | DC40DBF624C1987300557431 /* Sources */, 150 | DC40DBF724C1987300557431 /* Frameworks */, 151 | DC40DBF824C1987300557431 /* Resources */, 152 | ); 153 | buildRules = ( 154 | ); 155 | dependencies = ( 156 | ); 157 | name = lego; 158 | productName = lego; 159 | productReference = DC40DBFA24C1987300557431 /* lego.app */; 160 | productType = "com.apple.product-type.application"; 161 | }; 162 | DC40DC0A24C1987400557431 /* legoTests */ = { 163 | isa = PBXNativeTarget; 164 | buildConfigurationList = DC40DC2224C1987400557431 /* Build configuration list for PBXNativeTarget "legoTests" */; 165 | buildPhases = ( 166 | DC40DC0724C1987400557431 /* Sources */, 167 | DC40DC0824C1987400557431 /* Frameworks */, 168 | DC40DC0924C1987400557431 /* Resources */, 169 | ); 170 | buildRules = ( 171 | ); 172 | dependencies = ( 173 | DC40DC0D24C1987400557431 /* PBXTargetDependency */, 174 | ); 175 | name = legoTests; 176 | productName = legoTests; 177 | productReference = DC40DC0B24C1987400557431 /* legoTests.xctest */; 178 | productType = "com.apple.product-type.bundle.unit-test"; 179 | }; 180 | DC40DC1524C1987400557431 /* legoUITests */ = { 181 | isa = PBXNativeTarget; 182 | buildConfigurationList = DC40DC2524C1987400557431 /* Build configuration list for PBXNativeTarget "legoUITests" */; 183 | buildPhases = ( 184 | DC40DC1224C1987400557431 /* Sources */, 185 | DC40DC1324C1987400557431 /* Frameworks */, 186 | DC40DC1424C1987400557431 /* Resources */, 187 | ); 188 | buildRules = ( 189 | ); 190 | dependencies = ( 191 | DC40DC1824C1987400557431 /* PBXTargetDependency */, 192 | ); 193 | name = legoUITests; 194 | productName = legoUITests; 195 | productReference = DC40DC1624C1987400557431 /* legoUITests.xctest */; 196 | productType = "com.apple.product-type.bundle.ui-testing"; 197 | }; 198 | /* End PBXNativeTarget section */ 199 | 200 | /* Begin PBXProject section */ 201 | DC40DBF224C1987300557431 /* Project object */ = { 202 | isa = PBXProject; 203 | attributes = { 204 | LastSwiftUpdateCheck = 1200; 205 | LastUpgradeCheck = 1200; 206 | TargetAttributes = { 207 | DC40DBF924C1987300557431 = { 208 | CreatedOnToolsVersion = 12.0; 209 | }; 210 | DC40DC0A24C1987400557431 = { 211 | CreatedOnToolsVersion = 12.0; 212 | TestTargetID = DC40DBF924C1987300557431; 213 | }; 214 | DC40DC1524C1987400557431 = { 215 | CreatedOnToolsVersion = 12.0; 216 | TestTargetID = DC40DBF924C1987300557431; 217 | }; 218 | }; 219 | }; 220 | buildConfigurationList = DC40DBF524C1987300557431 /* Build configuration list for PBXProject "lego" */; 221 | compatibilityVersion = "Xcode 9.3"; 222 | developmentRegion = en; 223 | hasScannedForEncodings = 0; 224 | knownRegions = ( 225 | en, 226 | Base, 227 | ); 228 | mainGroup = DC40DBF124C1987300557431; 229 | productRefGroup = DC40DBFB24C1987300557431 /* Products */; 230 | projectDirPath = ""; 231 | projectRoot = ""; 232 | targets = ( 233 | DC40DBF924C1987300557431 /* lego */, 234 | DC40DC0A24C1987400557431 /* legoTests */, 235 | DC40DC1524C1987400557431 /* legoUITests */, 236 | ); 237 | }; 238 | /* End PBXProject section */ 239 | 240 | /* Begin PBXResourcesBuildPhase section */ 241 | DC40DBF824C1987300557431 /* Resources */ = { 242 | isa = PBXResourcesBuildPhase; 243 | buildActionMask = 2147483647; 244 | files = ( 245 | DC40DC0524C1987400557431 /* Preview Assets.xcassets in Resources */, 246 | DC40DC0224C1987400557431 /* Assets.xcassets in Resources */, 247 | DCC55FA224C57B4000994069 /* LegoAnimation.gif in Resources */, 248 | ); 249 | runOnlyForDeploymentPostprocessing = 0; 250 | }; 251 | DC40DC0924C1987400557431 /* Resources */ = { 252 | isa = PBXResourcesBuildPhase; 253 | buildActionMask = 2147483647; 254 | files = ( 255 | ); 256 | runOnlyForDeploymentPostprocessing = 0; 257 | }; 258 | DC40DC1424C1987400557431 /* Resources */ = { 259 | isa = PBXResourcesBuildPhase; 260 | buildActionMask = 2147483647; 261 | files = ( 262 | ); 263 | runOnlyForDeploymentPostprocessing = 0; 264 | }; 265 | /* End PBXResourcesBuildPhase section */ 266 | 267 | /* Begin PBXSourcesBuildPhase section */ 268 | DC40DBF624C1987300557431 /* Sources */ = { 269 | isa = PBXSourcesBuildPhase; 270 | buildActionMask = 2147483647; 271 | files = ( 272 | DCC55FA024C55A0900994069 /* LegoSet.swift in Sources */, 273 | DCC55F9E24C559C400994069 /* LegoBlock.swift in Sources */, 274 | DC40DC0024C1987300557431 /* ContentView.swift in Sources */, 275 | DC40DBFE24C1987300557431 /* legoApp.swift in Sources */, 276 | ); 277 | runOnlyForDeploymentPostprocessing = 0; 278 | }; 279 | DC40DC0724C1987400557431 /* Sources */ = { 280 | isa = PBXSourcesBuildPhase; 281 | buildActionMask = 2147483647; 282 | files = ( 283 | DC40DC1024C1987400557431 /* legoTests.swift in Sources */, 284 | ); 285 | runOnlyForDeploymentPostprocessing = 0; 286 | }; 287 | DC40DC1224C1987400557431 /* Sources */ = { 288 | isa = PBXSourcesBuildPhase; 289 | buildActionMask = 2147483647; 290 | files = ( 291 | DC40DC1B24C1987400557431 /* legoUITests.swift in Sources */, 292 | ); 293 | runOnlyForDeploymentPostprocessing = 0; 294 | }; 295 | /* End PBXSourcesBuildPhase section */ 296 | 297 | /* Begin PBXTargetDependency section */ 298 | DC40DC0D24C1987400557431 /* PBXTargetDependency */ = { 299 | isa = PBXTargetDependency; 300 | target = DC40DBF924C1987300557431 /* lego */; 301 | targetProxy = DC40DC0C24C1987400557431 /* PBXContainerItemProxy */; 302 | }; 303 | DC40DC1824C1987400557431 /* PBXTargetDependency */ = { 304 | isa = PBXTargetDependency; 305 | target = DC40DBF924C1987300557431 /* lego */; 306 | targetProxy = DC40DC1724C1987400557431 /* PBXContainerItemProxy */; 307 | }; 308 | /* End PBXTargetDependency section */ 309 | 310 | /* Begin XCBuildConfiguration section */ 311 | DC40DC1D24C1987400557431 /* Debug */ = { 312 | isa = XCBuildConfiguration; 313 | buildSettings = { 314 | ALWAYS_SEARCH_USER_PATHS = NO; 315 | CLANG_ANALYZER_NONNULL = YES; 316 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 317 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 318 | CLANG_CXX_LIBRARY = "libc++"; 319 | CLANG_ENABLE_MODULES = YES; 320 | CLANG_ENABLE_OBJC_ARC = YES; 321 | CLANG_ENABLE_OBJC_WEAK = YES; 322 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 323 | CLANG_WARN_BOOL_CONVERSION = YES; 324 | CLANG_WARN_COMMA = YES; 325 | CLANG_WARN_CONSTANT_CONVERSION = YES; 326 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 327 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 328 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 329 | CLANG_WARN_EMPTY_BODY = YES; 330 | CLANG_WARN_ENUM_CONVERSION = YES; 331 | CLANG_WARN_INFINITE_RECURSION = YES; 332 | CLANG_WARN_INT_CONVERSION = YES; 333 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 334 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 335 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 336 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 337 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 338 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 339 | CLANG_WARN_STRICT_PROTOTYPES = YES; 340 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 341 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 342 | CLANG_WARN_UNREACHABLE_CODE = YES; 343 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 344 | COPY_PHASE_STRIP = NO; 345 | DEBUG_INFORMATION_FORMAT = dwarf; 346 | ENABLE_STRICT_OBJC_MSGSEND = YES; 347 | ENABLE_TESTABILITY = YES; 348 | GCC_C_LANGUAGE_STANDARD = gnu11; 349 | GCC_DYNAMIC_NO_PIC = NO; 350 | GCC_NO_COMMON_BLOCKS = YES; 351 | GCC_OPTIMIZATION_LEVEL = 0; 352 | GCC_PREPROCESSOR_DEFINITIONS = ( 353 | "DEBUG=1", 354 | "$(inherited)", 355 | ); 356 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 357 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 358 | GCC_WARN_UNDECLARED_SELECTOR = YES; 359 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 360 | GCC_WARN_UNUSED_FUNCTION = YES; 361 | GCC_WARN_UNUSED_VARIABLE = YES; 362 | IPHONEOS_DEPLOYMENT_TARGET = 14.0; 363 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 364 | MTL_FAST_MATH = YES; 365 | ONLY_ACTIVE_ARCH = YES; 366 | SDKROOT = iphoneos; 367 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 368 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 369 | }; 370 | name = Debug; 371 | }; 372 | DC40DC1E24C1987400557431 /* Release */ = { 373 | isa = XCBuildConfiguration; 374 | buildSettings = { 375 | ALWAYS_SEARCH_USER_PATHS = NO; 376 | CLANG_ANALYZER_NONNULL = YES; 377 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 378 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 379 | CLANG_CXX_LIBRARY = "libc++"; 380 | CLANG_ENABLE_MODULES = YES; 381 | CLANG_ENABLE_OBJC_ARC = YES; 382 | CLANG_ENABLE_OBJC_WEAK = YES; 383 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 384 | CLANG_WARN_BOOL_CONVERSION = YES; 385 | CLANG_WARN_COMMA = YES; 386 | CLANG_WARN_CONSTANT_CONVERSION = YES; 387 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 388 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 389 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 390 | CLANG_WARN_EMPTY_BODY = YES; 391 | CLANG_WARN_ENUM_CONVERSION = YES; 392 | CLANG_WARN_INFINITE_RECURSION = YES; 393 | CLANG_WARN_INT_CONVERSION = YES; 394 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 395 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 396 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 397 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 398 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 399 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 400 | CLANG_WARN_STRICT_PROTOTYPES = YES; 401 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 402 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 403 | CLANG_WARN_UNREACHABLE_CODE = YES; 404 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 405 | COPY_PHASE_STRIP = NO; 406 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 407 | ENABLE_NS_ASSERTIONS = NO; 408 | ENABLE_STRICT_OBJC_MSGSEND = YES; 409 | GCC_C_LANGUAGE_STANDARD = gnu11; 410 | GCC_NO_COMMON_BLOCKS = YES; 411 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 412 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 413 | GCC_WARN_UNDECLARED_SELECTOR = YES; 414 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 415 | GCC_WARN_UNUSED_FUNCTION = YES; 416 | GCC_WARN_UNUSED_VARIABLE = YES; 417 | IPHONEOS_DEPLOYMENT_TARGET = 14.0; 418 | MTL_ENABLE_DEBUG_INFO = NO; 419 | MTL_FAST_MATH = YES; 420 | SDKROOT = iphoneos; 421 | SWIFT_COMPILATION_MODE = wholemodule; 422 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 423 | VALIDATE_PRODUCT = YES; 424 | }; 425 | name = Release; 426 | }; 427 | DC40DC2024C1987400557431 /* Debug */ = { 428 | isa = XCBuildConfiguration; 429 | buildSettings = { 430 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 431 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 432 | CODE_SIGN_STYLE = Automatic; 433 | DEVELOPMENT_ASSET_PATHS = "\"lego/Preview Content\""; 434 | DEVELOPMENT_TEAM = MLXZLWU95B; 435 | ENABLE_PREVIEWS = YES; 436 | INFOPLIST_FILE = lego/Info.plist; 437 | IPHONEOS_DEPLOYMENT_TARGET = 14.0; 438 | LD_RUNPATH_SEARCH_PATHS = ( 439 | "$(inherited)", 440 | "@executable_path/Frameworks", 441 | ); 442 | PRODUCT_BUNDLE_IDENTIFIER = svj.lego; 443 | PRODUCT_NAME = "$(TARGET_NAME)"; 444 | SWIFT_VERSION = 5.0; 445 | TARGETED_DEVICE_FAMILY = "1,2"; 446 | }; 447 | name = Debug; 448 | }; 449 | DC40DC2124C1987400557431 /* Release */ = { 450 | isa = XCBuildConfiguration; 451 | buildSettings = { 452 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 453 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 454 | CODE_SIGN_STYLE = Automatic; 455 | DEVELOPMENT_ASSET_PATHS = "\"lego/Preview Content\""; 456 | DEVELOPMENT_TEAM = MLXZLWU95B; 457 | ENABLE_PREVIEWS = YES; 458 | INFOPLIST_FILE = lego/Info.plist; 459 | IPHONEOS_DEPLOYMENT_TARGET = 14.0; 460 | LD_RUNPATH_SEARCH_PATHS = ( 461 | "$(inherited)", 462 | "@executable_path/Frameworks", 463 | ); 464 | PRODUCT_BUNDLE_IDENTIFIER = svj.lego; 465 | PRODUCT_NAME = "$(TARGET_NAME)"; 466 | SWIFT_VERSION = 5.0; 467 | TARGETED_DEVICE_FAMILY = "1,2"; 468 | }; 469 | name = Release; 470 | }; 471 | DC40DC2324C1987400557431 /* Debug */ = { 472 | isa = XCBuildConfiguration; 473 | buildSettings = { 474 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 475 | BUNDLE_LOADER = "$(TEST_HOST)"; 476 | CODE_SIGN_STYLE = Automatic; 477 | DEVELOPMENT_TEAM = MLXZLWU95B; 478 | INFOPLIST_FILE = legoTests/Info.plist; 479 | IPHONEOS_DEPLOYMENT_TARGET = 14.0; 480 | LD_RUNPATH_SEARCH_PATHS = ( 481 | "$(inherited)", 482 | "@executable_path/Frameworks", 483 | "@loader_path/Frameworks", 484 | ); 485 | PRODUCT_BUNDLE_IDENTIFIER = svj.legoTests; 486 | PRODUCT_NAME = "$(TARGET_NAME)"; 487 | SWIFT_VERSION = 5.0; 488 | TARGETED_DEVICE_FAMILY = "1,2"; 489 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/lego.app/lego"; 490 | }; 491 | name = Debug; 492 | }; 493 | DC40DC2424C1987400557431 /* Release */ = { 494 | isa = XCBuildConfiguration; 495 | buildSettings = { 496 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 497 | BUNDLE_LOADER = "$(TEST_HOST)"; 498 | CODE_SIGN_STYLE = Automatic; 499 | DEVELOPMENT_TEAM = MLXZLWU95B; 500 | INFOPLIST_FILE = legoTests/Info.plist; 501 | IPHONEOS_DEPLOYMENT_TARGET = 14.0; 502 | LD_RUNPATH_SEARCH_PATHS = ( 503 | "$(inherited)", 504 | "@executable_path/Frameworks", 505 | "@loader_path/Frameworks", 506 | ); 507 | PRODUCT_BUNDLE_IDENTIFIER = svj.legoTests; 508 | PRODUCT_NAME = "$(TARGET_NAME)"; 509 | SWIFT_VERSION = 5.0; 510 | TARGETED_DEVICE_FAMILY = "1,2"; 511 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/lego.app/lego"; 512 | }; 513 | name = Release; 514 | }; 515 | DC40DC2624C1987400557431 /* Debug */ = { 516 | isa = XCBuildConfiguration; 517 | buildSettings = { 518 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 519 | CODE_SIGN_STYLE = Automatic; 520 | DEVELOPMENT_TEAM = MLXZLWU95B; 521 | INFOPLIST_FILE = legoUITests/Info.plist; 522 | LD_RUNPATH_SEARCH_PATHS = ( 523 | "$(inherited)", 524 | "@executable_path/Frameworks", 525 | "@loader_path/Frameworks", 526 | ); 527 | PRODUCT_BUNDLE_IDENTIFIER = svj.legoUITests; 528 | PRODUCT_NAME = "$(TARGET_NAME)"; 529 | SWIFT_VERSION = 5.0; 530 | TARGETED_DEVICE_FAMILY = "1,2"; 531 | TEST_TARGET_NAME = lego; 532 | }; 533 | name = Debug; 534 | }; 535 | DC40DC2724C1987400557431 /* Release */ = { 536 | isa = XCBuildConfiguration; 537 | buildSettings = { 538 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 539 | CODE_SIGN_STYLE = Automatic; 540 | DEVELOPMENT_TEAM = MLXZLWU95B; 541 | INFOPLIST_FILE = legoUITests/Info.plist; 542 | LD_RUNPATH_SEARCH_PATHS = ( 543 | "$(inherited)", 544 | "@executable_path/Frameworks", 545 | "@loader_path/Frameworks", 546 | ); 547 | PRODUCT_BUNDLE_IDENTIFIER = svj.legoUITests; 548 | PRODUCT_NAME = "$(TARGET_NAME)"; 549 | SWIFT_VERSION = 5.0; 550 | TARGETED_DEVICE_FAMILY = "1,2"; 551 | TEST_TARGET_NAME = lego; 552 | }; 553 | name = Release; 554 | }; 555 | /* End XCBuildConfiguration section */ 556 | 557 | /* Begin XCConfigurationList section */ 558 | DC40DBF524C1987300557431 /* Build configuration list for PBXProject "lego" */ = { 559 | isa = XCConfigurationList; 560 | buildConfigurations = ( 561 | DC40DC1D24C1987400557431 /* Debug */, 562 | DC40DC1E24C1987400557431 /* Release */, 563 | ); 564 | defaultConfigurationIsVisible = 0; 565 | defaultConfigurationName = Release; 566 | }; 567 | DC40DC1F24C1987400557431 /* Build configuration list for PBXNativeTarget "lego" */ = { 568 | isa = XCConfigurationList; 569 | buildConfigurations = ( 570 | DC40DC2024C1987400557431 /* Debug */, 571 | DC40DC2124C1987400557431 /* Release */, 572 | ); 573 | defaultConfigurationIsVisible = 0; 574 | defaultConfigurationName = Release; 575 | }; 576 | DC40DC2224C1987400557431 /* Build configuration list for PBXNativeTarget "legoTests" */ = { 577 | isa = XCConfigurationList; 578 | buildConfigurations = ( 579 | DC40DC2324C1987400557431 /* Debug */, 580 | DC40DC2424C1987400557431 /* Release */, 581 | ); 582 | defaultConfigurationIsVisible = 0; 583 | defaultConfigurationName = Release; 584 | }; 585 | DC40DC2524C1987400557431 /* Build configuration list for PBXNativeTarget "legoUITests" */ = { 586 | isa = XCConfigurationList; 587 | buildConfigurations = ( 588 | DC40DC2624C1987400557431 /* Debug */, 589 | DC40DC2724C1987400557431 /* Release */, 590 | ); 591 | defaultConfigurationIsVisible = 0; 592 | defaultConfigurationName = Release; 593 | }; 594 | /* End XCConfigurationList section */ 595 | }; 596 | rootObject = DC40DBF224C1987300557431 /* Project object */; 597 | } 598 | -------------------------------------------------------------------------------- /lego.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /lego.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /lego.xcodeproj/project.xcworkspace/xcuserdata/shivamvijaywargiya.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vijaywargiya/LegoLoadingAnimation-SwiftUI/566affa2417b3d1b2b091e0518284e354dfb0693/lego.xcodeproj/project.xcworkspace/xcuserdata/shivamvijaywargiya.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /lego.xcodeproj/xcuserdata/shivamvijaywargiya.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | lego.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /lego/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 | -------------------------------------------------------------------------------- /lego/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 | -------------------------------------------------------------------------------- /lego/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /lego/Assets.xcassets/cube.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "icons8-sugar-cube-100.png", 5 | "idiom" : "universal", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "author" : "xcode", 19 | "version" : 1 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /lego/Assets.xcassets/cube.imageset/icons8-sugar-cube-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vijaywargiya/LegoLoadingAnimation-SwiftUI/566affa2417b3d1b2b091e0518284e354dfb0693/lego/Assets.xcassets/cube.imageset/icons8-sugar-cube-100.png -------------------------------------------------------------------------------- /lego/ContentView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ContentView.swift 3 | // lego 4 | // 5 | // Created by Shivam Vijaywargiya on 17/07/20. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct ContentView: View { 11 | var body: some View { 12 | LegoSet() 13 | } 14 | } 15 | 16 | struct ContentView_Previews: PreviewProvider { 17 | static var previews: some View { 18 | ContentView() 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /lego/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 | -------------------------------------------------------------------------------- /lego/LegoBlock.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LegoBlock.swift 3 | // lego 4 | // 5 | // Created by Shivam Vijaywargiya on 20/07/20. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct LegoBlock: View { 11 | var color: Color 12 | 13 | var body: some View { 14 | Rectangle().fill(color) 15 | .frame(width: 100, height: /*@START_MENU_TOKEN@*/100/*@END_MENU_TOKEN@*/, alignment: /*@START_MENU_TOKEN@*/.center/*@END_MENU_TOKEN@*/) 16 | .mask(Image("cube")) 17 | .overlay(Image("cube").opacity(color == Color(.clear) ? 0 : 0.5)) 18 | } 19 | } 20 | 21 | struct LegoBlock_Previews: PreviewProvider { 22 | static var previews: some View { 23 | LegoBlock(color: Color.red) 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /lego/LegoSet.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LegoSet.swift 3 | // lego 4 | // 5 | // Created by Shivam Vijaywargiya on 20/07/20. 6 | // 7 | 8 | import SwiftUI 9 | 10 | enum AllBlocks: CaseIterable { 11 | 12 | static var indexOffset: Int = 0 13 | 14 | 15 | case one,two,three,four,five,clear 16 | 17 | var view: AnyView { 18 | switch self { 19 | case .one: 20 | return AnyView(LegoBlock(color: Color(.systemYellow))) 21 | case .two: 22 | return AnyView(LegoBlock(color: Color(.systemBlue))) 23 | case .three: 24 | return AnyView(LegoBlock(color: Color(.systemOrange))) 25 | case .four: 26 | return AnyView(LegoBlock(color: Color(.systemRed))) 27 | case .five: 28 | return AnyView(LegoBlock(color: Color(.systemGreen))) 29 | default: 30 | return AnyView(EmptyView()) 31 | } 32 | } 33 | } 34 | 35 | struct LegoSet: View { 36 | @State var allBlocks = AllBlocks.allCases 37 | @State var allIndices: [(CGFloat, CGFloat, Double, Bool)] = [ 38 | (-80,40, 5, true), 39 | (-40,20, 3, false), 40 | (0,0, 1, false), 41 | (40,20, 2, true), 42 | (0,40, 4, false), 43 | (-40,60, 6, false) 44 | ] 45 | @State var currentIndex: Int = 4 46 | 47 | var body: some View { 48 | ZStack { 49 | ForEach(0.. some View { 61 | let offset = allIndices[index] 62 | return allBlocks[index].view 63 | .offset(x: offset.0, y: offset.1) 64 | .zIndex(offset.2) 65 | } 66 | 67 | func rotate() { 68 | let clearPosition = allIndices[5] 69 | 70 | allIndices[5] = allIndices[currentIndex] 71 | allIndices[currentIndex] = clearPosition 72 | 73 | currentIndex = currentIndex - 1 74 | 75 | if currentIndex == -1 { 76 | currentIndex = 4 77 | } 78 | 79 | if allIndices[currentIndex].3 { 80 | DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { 81 | withAnimation { 82 | rotate() 83 | } 84 | } 85 | 86 | } else { 87 | DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) { 88 | withAnimation { 89 | rotate() 90 | } 91 | } 92 | } 93 | } 94 | } 95 | 96 | struct LegoSet_Previews: PreviewProvider { 97 | static var previews: some View { 98 | LegoSet() 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /lego/Preview Content/Preview Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /lego/legoApp.swift: -------------------------------------------------------------------------------- 1 | // 2 | // legoApp.swift 3 | // lego 4 | // 5 | // Created by Shivam Vijaywargiya on 17/07/20. 6 | // 7 | 8 | import SwiftUI 9 | 10 | @main 11 | struct legoApp: App { 12 | var body: some Scene { 13 | WindowGroup { 14 | ContentView() 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /legoTests/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 | 22 | 23 | -------------------------------------------------------------------------------- /legoTests/legoTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // legoTests.swift 3 | // legoTests 4 | // 5 | // Created by Shivam Vijaywargiya on 17/07/20. 6 | // 7 | 8 | import XCTest 9 | @testable import lego 10 | 11 | class legoTests: XCTestCase { 12 | 13 | override func setUpWithError() throws { 14 | // Put setup code here. This method is called before the invocation of each test method in the class. 15 | } 16 | 17 | override func tearDownWithError() throws { 18 | // Put teardown code here. This method is called after the invocation of each test method in the class. 19 | } 20 | 21 | func testExample() throws { 22 | // This is an example of a functional test case. 23 | // Use XCTAssert and related functions to verify your tests produce the correct results. 24 | } 25 | 26 | func testPerformanceExample() throws { 27 | // This is an example of a performance test case. 28 | self.measure { 29 | // Put the code you want to measure the time of here. 30 | } 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /legoUITests/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 | 22 | 23 | -------------------------------------------------------------------------------- /legoUITests/legoUITests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // legoUITests.swift 3 | // legoUITests 4 | // 5 | // Created by Shivam Vijaywargiya on 17/07/20. 6 | // 7 | 8 | import XCTest 9 | 10 | class legoUITests: XCTestCase { 11 | 12 | override func setUpWithError() throws { 13 | // Put setup code here. This method is called before the invocation of each test method in the class. 14 | 15 | // In UI tests it is usually best to stop immediately when a failure occurs. 16 | continueAfterFailure = false 17 | 18 | // 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. 19 | } 20 | 21 | override func tearDownWithError() throws { 22 | // Put teardown code here. This method is called after the invocation of each test method in the class. 23 | } 24 | 25 | func testExample() throws { 26 | // UI tests must launch the application that they test. 27 | let app = XCUIApplication() 28 | app.launch() 29 | 30 | // Use recording to get started writing UI tests. 31 | // Use XCTAssert and related functions to verify your tests produce the correct results. 32 | } 33 | 34 | func testLaunchPerformance() throws { 35 | if #available(macOS 10.15, iOS 13.0, tvOS 13.0, *) { 36 | // This measures how long it takes to launch your application. 37 | measure(metrics: [XCTApplicationLaunchMetric()]) { 38 | XCUIApplication().launch() 39 | } 40 | } 41 | } 42 | } 43 | --------------------------------------------------------------------------------