├── .gitignore ├── InfiniteListSwiftUI.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ └── xcuserdata │ │ └── vadim.bulavin.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── vadim.bulavin.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist ├── InfiniteListSwiftUI ├── App │ ├── AppDelegate.swift │ └── SceneDelegate.swift ├── GithubAPI.swift ├── Preview Content │ └── Preview Assets.xcassets │ │ └── Contents.json ├── RepositoriesList.swift ├── Spinner.swift └── SupportingFiles │ ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── Contents.json │ ├── Base.lproj │ └── LaunchScreen.storyboard │ └── Info.plist ├── LICENSE ├── README.md └── demo.gif /.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/ -------------------------------------------------------------------------------- /InfiniteListSwiftUI.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 880764BD249154EE002FE7AE /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 880764BC249154EE002FE7AE /* AppDelegate.swift */; }; 11 | 880764BF249154EE002FE7AE /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 880764BE249154EE002FE7AE /* SceneDelegate.swift */; }; 12 | 880764C3249154F0002FE7AE /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 880764C2249154F0002FE7AE /* Assets.xcassets */; }; 13 | 880764C6249154F0002FE7AE /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 880764C5249154F0002FE7AE /* Preview Assets.xcassets */; }; 14 | 880764C9249154F0002FE7AE /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 880764C7249154F0002FE7AE /* LaunchScreen.storyboard */; }; 15 | 880764D324915582002FE7AE /* RepositoriesList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 880764D224915582002FE7AE /* RepositoriesList.swift */; }; 16 | 880764DA24915D7B002FE7AE /* Spinner.swift in Sources */ = {isa = PBXBuildFile; fileRef = 880764D524915D7B002FE7AE /* Spinner.swift */; }; 17 | 880764E12492069B002FE7AE /* GithubAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 880764E02492069B002FE7AE /* GithubAPI.swift */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXFileReference section */ 21 | 880764B9249154EE002FE7AE /* InfiniteListSwiftUI.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = InfiniteListSwiftUI.app; sourceTree = BUILT_PRODUCTS_DIR; }; 22 | 880764BC249154EE002FE7AE /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 23 | 880764BE249154EE002FE7AE /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; 24 | 880764C2249154F0002FE7AE /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 25 | 880764C5249154F0002FE7AE /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; 26 | 880764C8249154F0002FE7AE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 27 | 880764CA249154F0002FE7AE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 28 | 880764D224915582002FE7AE /* RepositoriesList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RepositoriesList.swift; sourceTree = ""; }; 29 | 880764D524915D7B002FE7AE /* Spinner.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Spinner.swift; sourceTree = ""; }; 30 | 880764E02492069B002FE7AE /* GithubAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GithubAPI.swift; sourceTree = ""; }; 31 | /* End PBXFileReference section */ 32 | 33 | /* Begin PBXFrameworksBuildPhase section */ 34 | 880764B6249154EE002FE7AE /* Frameworks */ = { 35 | isa = PBXFrameworksBuildPhase; 36 | buildActionMask = 2147483647; 37 | files = ( 38 | ); 39 | runOnlyForDeploymentPostprocessing = 0; 40 | }; 41 | /* End PBXFrameworksBuildPhase section */ 42 | 43 | /* Begin PBXGroup section */ 44 | 880764B0249154EE002FE7AE = { 45 | isa = PBXGroup; 46 | children = ( 47 | 880764BB249154EE002FE7AE /* InfiniteListSwiftUI */, 48 | 880764BA249154EE002FE7AE /* Products */, 49 | ); 50 | sourceTree = ""; 51 | }; 52 | 880764BA249154EE002FE7AE /* Products */ = { 53 | isa = PBXGroup; 54 | children = ( 55 | 880764B9249154EE002FE7AE /* InfiniteListSwiftUI.app */, 56 | ); 57 | name = Products; 58 | sourceTree = ""; 59 | }; 60 | 880764BB249154EE002FE7AE /* InfiniteListSwiftUI */ = { 61 | isa = PBXGroup; 62 | children = ( 63 | 880764D1249154FE002FE7AE /* App */, 64 | 880764D224915582002FE7AE /* RepositoriesList.swift */, 65 | 880764E02492069B002FE7AE /* GithubAPI.swift */, 66 | 880764D524915D7B002FE7AE /* Spinner.swift */, 67 | 880764D0249154F6002FE7AE /* SupportingFiles */, 68 | 880764C4249154F0002FE7AE /* Preview Content */, 69 | ); 70 | path = InfiniteListSwiftUI; 71 | sourceTree = ""; 72 | }; 73 | 880764C4249154F0002FE7AE /* Preview Content */ = { 74 | isa = PBXGroup; 75 | children = ( 76 | 880764C5249154F0002FE7AE /* Preview Assets.xcassets */, 77 | ); 78 | path = "Preview Content"; 79 | sourceTree = ""; 80 | }; 81 | 880764D0249154F6002FE7AE /* SupportingFiles */ = { 82 | isa = PBXGroup; 83 | children = ( 84 | 880764C2249154F0002FE7AE /* Assets.xcassets */, 85 | 880764C7249154F0002FE7AE /* LaunchScreen.storyboard */, 86 | 880764CA249154F0002FE7AE /* Info.plist */, 87 | ); 88 | path = SupportingFiles; 89 | sourceTree = ""; 90 | }; 91 | 880764D1249154FE002FE7AE /* App */ = { 92 | isa = PBXGroup; 93 | children = ( 94 | 880764BC249154EE002FE7AE /* AppDelegate.swift */, 95 | 880764BE249154EE002FE7AE /* SceneDelegate.swift */, 96 | ); 97 | path = App; 98 | sourceTree = ""; 99 | }; 100 | /* End PBXGroup section */ 101 | 102 | /* Begin PBXNativeTarget section */ 103 | 880764B8249154EE002FE7AE /* InfiniteListSwiftUI */ = { 104 | isa = PBXNativeTarget; 105 | buildConfigurationList = 880764CD249154F0002FE7AE /* Build configuration list for PBXNativeTarget "InfiniteListSwiftUI" */; 106 | buildPhases = ( 107 | 880764B5249154EE002FE7AE /* Sources */, 108 | 880764B6249154EE002FE7AE /* Frameworks */, 109 | 880764B7249154EE002FE7AE /* Resources */, 110 | ); 111 | buildRules = ( 112 | ); 113 | dependencies = ( 114 | ); 115 | name = InfiniteListSwiftUI; 116 | productName = InfiniteListSwiftUI; 117 | productReference = 880764B9249154EE002FE7AE /* InfiniteListSwiftUI.app */; 118 | productType = "com.apple.product-type.application"; 119 | }; 120 | /* End PBXNativeTarget section */ 121 | 122 | /* Begin PBXProject section */ 123 | 880764B1249154EE002FE7AE /* Project object */ = { 124 | isa = PBXProject; 125 | attributes = { 126 | LastSwiftUpdateCheck = 1150; 127 | LastUpgradeCheck = 1150; 128 | ORGANIZATIONNAME = "Vadim Bulavin"; 129 | TargetAttributes = { 130 | 880764B8249154EE002FE7AE = { 131 | CreatedOnToolsVersion = 11.5; 132 | }; 133 | }; 134 | }; 135 | buildConfigurationList = 880764B4249154EE002FE7AE /* Build configuration list for PBXProject "InfiniteListSwiftUI" */; 136 | compatibilityVersion = "Xcode 9.3"; 137 | developmentRegion = en; 138 | hasScannedForEncodings = 0; 139 | knownRegions = ( 140 | en, 141 | Base, 142 | ); 143 | mainGroup = 880764B0249154EE002FE7AE; 144 | productRefGroup = 880764BA249154EE002FE7AE /* Products */; 145 | projectDirPath = ""; 146 | projectRoot = ""; 147 | targets = ( 148 | 880764B8249154EE002FE7AE /* InfiniteListSwiftUI */, 149 | ); 150 | }; 151 | /* End PBXProject section */ 152 | 153 | /* Begin PBXResourcesBuildPhase section */ 154 | 880764B7249154EE002FE7AE /* Resources */ = { 155 | isa = PBXResourcesBuildPhase; 156 | buildActionMask = 2147483647; 157 | files = ( 158 | 880764C9249154F0002FE7AE /* LaunchScreen.storyboard in Resources */, 159 | 880764C6249154F0002FE7AE /* Preview Assets.xcassets in Resources */, 160 | 880764C3249154F0002FE7AE /* Assets.xcassets in Resources */, 161 | ); 162 | runOnlyForDeploymentPostprocessing = 0; 163 | }; 164 | /* End PBXResourcesBuildPhase section */ 165 | 166 | /* Begin PBXSourcesBuildPhase section */ 167 | 880764B5249154EE002FE7AE /* Sources */ = { 168 | isa = PBXSourcesBuildPhase; 169 | buildActionMask = 2147483647; 170 | files = ( 171 | 880764E12492069B002FE7AE /* GithubAPI.swift in Sources */, 172 | 880764BD249154EE002FE7AE /* AppDelegate.swift in Sources */, 173 | 880764BF249154EE002FE7AE /* SceneDelegate.swift in Sources */, 174 | 880764D324915582002FE7AE /* RepositoriesList.swift in Sources */, 175 | 880764DA24915D7B002FE7AE /* Spinner.swift in Sources */, 176 | ); 177 | runOnlyForDeploymentPostprocessing = 0; 178 | }; 179 | /* End PBXSourcesBuildPhase section */ 180 | 181 | /* Begin PBXVariantGroup section */ 182 | 880764C7249154F0002FE7AE /* LaunchScreen.storyboard */ = { 183 | isa = PBXVariantGroup; 184 | children = ( 185 | 880764C8249154F0002FE7AE /* Base */, 186 | ); 187 | name = LaunchScreen.storyboard; 188 | sourceTree = ""; 189 | }; 190 | /* End PBXVariantGroup section */ 191 | 192 | /* Begin XCBuildConfiguration section */ 193 | 880764CB249154F0002FE7AE /* Debug */ = { 194 | isa = XCBuildConfiguration; 195 | buildSettings = { 196 | ALWAYS_SEARCH_USER_PATHS = NO; 197 | CLANG_ANALYZER_NONNULL = YES; 198 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 199 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 200 | CLANG_CXX_LIBRARY = "libc++"; 201 | CLANG_ENABLE_MODULES = YES; 202 | CLANG_ENABLE_OBJC_ARC = YES; 203 | CLANG_ENABLE_OBJC_WEAK = YES; 204 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 205 | CLANG_WARN_BOOL_CONVERSION = YES; 206 | CLANG_WARN_COMMA = YES; 207 | CLANG_WARN_CONSTANT_CONVERSION = YES; 208 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 209 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 210 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 211 | CLANG_WARN_EMPTY_BODY = YES; 212 | CLANG_WARN_ENUM_CONVERSION = YES; 213 | CLANG_WARN_INFINITE_RECURSION = YES; 214 | CLANG_WARN_INT_CONVERSION = YES; 215 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 216 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 217 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 218 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 219 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 220 | CLANG_WARN_STRICT_PROTOTYPES = YES; 221 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 222 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 223 | CLANG_WARN_UNREACHABLE_CODE = YES; 224 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 225 | COPY_PHASE_STRIP = NO; 226 | DEBUG_INFORMATION_FORMAT = dwarf; 227 | ENABLE_STRICT_OBJC_MSGSEND = YES; 228 | ENABLE_TESTABILITY = YES; 229 | GCC_C_LANGUAGE_STANDARD = gnu11; 230 | GCC_DYNAMIC_NO_PIC = NO; 231 | GCC_NO_COMMON_BLOCKS = YES; 232 | GCC_OPTIMIZATION_LEVEL = 0; 233 | GCC_PREPROCESSOR_DEFINITIONS = ( 234 | "DEBUG=1", 235 | "$(inherited)", 236 | ); 237 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 238 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 239 | GCC_WARN_UNDECLARED_SELECTOR = YES; 240 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 241 | GCC_WARN_UNUSED_FUNCTION = YES; 242 | GCC_WARN_UNUSED_VARIABLE = YES; 243 | IPHONEOS_DEPLOYMENT_TARGET = 13.5; 244 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 245 | MTL_FAST_MATH = YES; 246 | ONLY_ACTIVE_ARCH = YES; 247 | SDKROOT = iphoneos; 248 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 249 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 250 | }; 251 | name = Debug; 252 | }; 253 | 880764CC249154F0002FE7AE /* Release */ = { 254 | isa = XCBuildConfiguration; 255 | buildSettings = { 256 | ALWAYS_SEARCH_USER_PATHS = NO; 257 | CLANG_ANALYZER_NONNULL = YES; 258 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 259 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 260 | CLANG_CXX_LIBRARY = "libc++"; 261 | CLANG_ENABLE_MODULES = YES; 262 | CLANG_ENABLE_OBJC_ARC = YES; 263 | CLANG_ENABLE_OBJC_WEAK = YES; 264 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 265 | CLANG_WARN_BOOL_CONVERSION = YES; 266 | CLANG_WARN_COMMA = YES; 267 | CLANG_WARN_CONSTANT_CONVERSION = YES; 268 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 269 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 270 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 271 | CLANG_WARN_EMPTY_BODY = YES; 272 | CLANG_WARN_ENUM_CONVERSION = YES; 273 | CLANG_WARN_INFINITE_RECURSION = YES; 274 | CLANG_WARN_INT_CONVERSION = YES; 275 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 276 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 277 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 278 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 279 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 280 | CLANG_WARN_STRICT_PROTOTYPES = YES; 281 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 282 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 283 | CLANG_WARN_UNREACHABLE_CODE = YES; 284 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 285 | COPY_PHASE_STRIP = NO; 286 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 287 | ENABLE_NS_ASSERTIONS = NO; 288 | ENABLE_STRICT_OBJC_MSGSEND = YES; 289 | GCC_C_LANGUAGE_STANDARD = gnu11; 290 | GCC_NO_COMMON_BLOCKS = YES; 291 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 292 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 293 | GCC_WARN_UNDECLARED_SELECTOR = YES; 294 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 295 | GCC_WARN_UNUSED_FUNCTION = YES; 296 | GCC_WARN_UNUSED_VARIABLE = YES; 297 | IPHONEOS_DEPLOYMENT_TARGET = 13.5; 298 | MTL_ENABLE_DEBUG_INFO = NO; 299 | MTL_FAST_MATH = YES; 300 | SDKROOT = iphoneos; 301 | SWIFT_COMPILATION_MODE = wholemodule; 302 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 303 | VALIDATE_PRODUCT = YES; 304 | }; 305 | name = Release; 306 | }; 307 | 880764CE249154F0002FE7AE /* Debug */ = { 308 | isa = XCBuildConfiguration; 309 | buildSettings = { 310 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 311 | CODE_SIGN_STYLE = Automatic; 312 | DEVELOPMENT_ASSET_PATHS = "\"InfiniteListSwiftUI/Preview Content\""; 313 | ENABLE_PREVIEWS = YES; 314 | INFOPLIST_FILE = InfiniteListSwiftUI/SupportingFiles/Info.plist; 315 | LD_RUNPATH_SEARCH_PATHS = ( 316 | "$(inherited)", 317 | "@executable_path/Frameworks", 318 | ); 319 | PRODUCT_BUNDLE_IDENTIFIER = vadimbulavin.InfiniteListSwiftUI; 320 | PRODUCT_NAME = "$(TARGET_NAME)"; 321 | SWIFT_VERSION = 5.0; 322 | TARGETED_DEVICE_FAMILY = "1,2"; 323 | }; 324 | name = Debug; 325 | }; 326 | 880764CF249154F0002FE7AE /* Release */ = { 327 | isa = XCBuildConfiguration; 328 | buildSettings = { 329 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 330 | CODE_SIGN_STYLE = Automatic; 331 | DEVELOPMENT_ASSET_PATHS = "\"InfiniteListSwiftUI/Preview Content\""; 332 | ENABLE_PREVIEWS = YES; 333 | INFOPLIST_FILE = InfiniteListSwiftUI/SupportingFiles/Info.plist; 334 | LD_RUNPATH_SEARCH_PATHS = ( 335 | "$(inherited)", 336 | "@executable_path/Frameworks", 337 | ); 338 | PRODUCT_BUNDLE_IDENTIFIER = vadimbulavin.InfiniteListSwiftUI; 339 | PRODUCT_NAME = "$(TARGET_NAME)"; 340 | SWIFT_VERSION = 5.0; 341 | TARGETED_DEVICE_FAMILY = "1,2"; 342 | }; 343 | name = Release; 344 | }; 345 | /* End XCBuildConfiguration section */ 346 | 347 | /* Begin XCConfigurationList section */ 348 | 880764B4249154EE002FE7AE /* Build configuration list for PBXProject "InfiniteListSwiftUI" */ = { 349 | isa = XCConfigurationList; 350 | buildConfigurations = ( 351 | 880764CB249154F0002FE7AE /* Debug */, 352 | 880764CC249154F0002FE7AE /* Release */, 353 | ); 354 | defaultConfigurationIsVisible = 0; 355 | defaultConfigurationName = Release; 356 | }; 357 | 880764CD249154F0002FE7AE /* Build configuration list for PBXNativeTarget "InfiniteListSwiftUI" */ = { 358 | isa = XCConfigurationList; 359 | buildConfigurations = ( 360 | 880764CE249154F0002FE7AE /* Debug */, 361 | 880764CF249154F0002FE7AE /* Release */, 362 | ); 363 | defaultConfigurationIsVisible = 0; 364 | defaultConfigurationName = Release; 365 | }; 366 | /* End XCConfigurationList section */ 367 | }; 368 | rootObject = 880764B1249154EE002FE7AE /* Project object */; 369 | } 370 | -------------------------------------------------------------------------------- /InfiniteListSwiftUI.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /InfiniteListSwiftUI.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /InfiniteListSwiftUI.xcodeproj/project.xcworkspace/xcuserdata/vadim.bulavin.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/V8tr/InfiniteListSwiftUI/f064cab5f400911fd9602cd21490c3662889d749/InfiniteListSwiftUI.xcodeproj/project.xcworkspace/xcuserdata/vadim.bulavin.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /InfiniteListSwiftUI.xcodeproj/xcuserdata/vadim.bulavin.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | InfiniteListSwiftUI.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /InfiniteListSwiftUI/App/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // InfiniteListSwiftUI 4 | // 5 | // Created by Vadim Bulavin on 6/10/20. 6 | // Copyright © 2020 Vadim Bulavin. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 15 | return true 16 | } 17 | 18 | func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { 19 | return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /InfiniteListSwiftUI/App/SceneDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SceneDelegate.swift 3 | // InfiniteListSwiftUI 4 | // 5 | // Created by Vadim Bulavin on 6/10/20. 6 | // Copyright © 2020 Vadim Bulavin. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import SwiftUI 11 | 12 | class SceneDelegate: UIResponder, UIWindowSceneDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { 17 | if let windowScene = scene as? UIWindowScene { 18 | let window = UIWindow(windowScene: windowScene) 19 | window.rootViewController = UIHostingController(rootView: RepositoriesListContainer(viewModel: RepositoriesViewModel())) 20 | self.window = window 21 | window.makeKeyAndVisible() 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /InfiniteListSwiftUI/GithubAPI.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GithubAPI.swift 3 | // InfiniteListSwiftUI 4 | // 5 | // Created by Vadim Bulavin on 6/11/20. 6 | // Copyright © 2020 Vadim Bulavin. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import Combine 11 | 12 | enum GithubAPI { 13 | static let pageSize = 10 14 | 15 | static func searchRepos(query: String, page: Int) -> AnyPublisher<[Repository], Error> { 16 | let url = URL(string: "https://api.github.com/search/repositories?q=\(query)&sort=stars&per_page=\(Self.pageSize)&page=\(page)")! 17 | return URLSession.shared 18 | .dataTaskPublisher(for: url) 19 | .handleEvents(receiveOutput: { print(NSString(data: $0.data, encoding: String.Encoding.utf8.rawValue)!) }) 20 | .tryMap { try JSONDecoder().decode(GithubSearchResult.self, from: $0.data).items } 21 | .receive(on: DispatchQueue.main) 22 | .eraseToAnyPublisher() 23 | } 24 | } 25 | 26 | struct GithubSearchResult: Codable { 27 | let items: [T] 28 | } 29 | 30 | struct Repository: Codable, Identifiable, Equatable { 31 | let id: Int 32 | let name: String 33 | let description: String? 34 | let stargazers_count: Int 35 | } 36 | -------------------------------------------------------------------------------- /InfiniteListSwiftUI/Preview Content/Preview Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /InfiniteListSwiftUI/RepositoriesList.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RepositoriesList.swift 3 | // InfiniteListSwiftUI 4 | // 5 | // Created by Vadim Bulavin on 6/10/20. 6 | // Copyright © 2020 Vadim Bulavin. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | import Combine 11 | 12 | class RepositoriesViewModel: ObservableObject { 13 | @Published private(set) var state = State() 14 | private var subscriptions = Set() 15 | 16 | func fetchNextPageIfPossible() { 17 | guard state.canLoadNextPage else { return } 18 | 19 | GithubAPI.searchRepos(query: "swift", page: state.page) 20 | .sink(receiveCompletion: onReceive, 21 | receiveValue: onReceive) 22 | .store(in: &subscriptions) 23 | } 24 | 25 | private func onReceive(_ completion: Subscribers.Completion) { 26 | switch completion { 27 | case .finished: 28 | break 29 | case .failure: 30 | state.canLoadNextPage = false 31 | } 32 | } 33 | 34 | private func onReceive(_ batch: [Repository]) { 35 | state.repos += batch 36 | state.page += 1 37 | state.canLoadNextPage = batch.count == GithubAPI.pageSize 38 | } 39 | 40 | struct State { 41 | var repos: [Repository] = [] 42 | var page: Int = 1 43 | var canLoadNextPage = true 44 | } 45 | } 46 | 47 | struct RepositoriesListContainer: View { 48 | @ObservedObject var viewModel: RepositoriesViewModel 49 | 50 | var body: some View { 51 | RepositoriesList( 52 | repos: viewModel.state.repos, 53 | isLoading: viewModel.state.canLoadNextPage, 54 | onScrolledAtBottom: viewModel.fetchNextPageIfPossible 55 | ) 56 | .onAppear(perform: viewModel.fetchNextPageIfPossible) 57 | } 58 | } 59 | 60 | struct RepositoriesList: View { 61 | let repos: [Repository] 62 | let isLoading: Bool 63 | let onScrolledAtBottom: () -> Void 64 | 65 | var body: some View { 66 | List { 67 | reposList 68 | if isLoading { 69 | loadingIndicator 70 | } 71 | } 72 | } 73 | 74 | private var reposList: some View { 75 | ForEach(repos) { repo in 76 | RepositoryRow(repo: repo).onAppear { 77 | if self.repos.last == repo { 78 | self.onScrolledAtBottom() 79 | } 80 | } 81 | } 82 | } 83 | 84 | private var loadingIndicator: some View { 85 | Spinner(style: .medium) 86 | .frame(idealWidth: .infinity, maxWidth: .infinity, alignment: .center) 87 | } 88 | } 89 | 90 | struct RepositoryRow: View { 91 | let repo: Repository 92 | 93 | var body: some View { 94 | VStack { 95 | Text(repo.name).font(.title) 96 | Text("⭐️ \(repo.stargazers_count)") 97 | repo.description.map(Text.init)?.font(.body) 98 | } 99 | .frame(idealWidth: .infinity, maxWidth: .infinity, alignment: .center) 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /InfiniteListSwiftUI/Spinner.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Spinner.swift 3 | // ModernMVVM 4 | // 5 | // Created by Vadym Bulavin on 2/18/20. 6 | // Copyright © 2020 Vadym Bulavin. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | import UIKit 11 | 12 | struct Spinner: UIViewRepresentable { 13 | let style: UIActivityIndicatorView.Style 14 | 15 | func makeUIView(context: Context) -> UIActivityIndicatorView { 16 | let spinner = UIActivityIndicatorView(style: style) 17 | spinner.hidesWhenStopped = true 18 | spinner.startAnimating() 19 | return spinner 20 | } 21 | 22 | func updateUIView(_ uiView: UIActivityIndicatorView, context: Context) {} 23 | } 24 | -------------------------------------------------------------------------------- /InfiniteListSwiftUI/SupportingFiles/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 | -------------------------------------------------------------------------------- /InfiniteListSwiftUI/SupportingFiles/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /InfiniteListSwiftUI/SupportingFiles/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /InfiniteListSwiftUI/SupportingFiles/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 | UISceneConfigurations 28 | 29 | UIWindowSceneSessionRoleApplication 30 | 31 | 32 | UISceneConfigurationName 33 | Default Configuration 34 | UISceneDelegateClassName 35 | $(PRODUCT_MODULE_NAME).SceneDelegate 36 | 37 | 38 | 39 | 40 | UILaunchStoryboardName 41 | LaunchScreen 42 | UIRequiredDeviceCapabilities 43 | 44 | armv7 45 | 46 | UISupportedInterfaceOrientations 47 | 48 | UIInterfaceOrientationPortrait 49 | UIInterfaceOrientationLandscapeLeft 50 | UIInterfaceOrientationLandscapeRight 51 | 52 | UISupportedInterfaceOrientations~ipad 53 | 54 | UIInterfaceOrientationPortrait 55 | UIInterfaceOrientationPortraitUpsideDown 56 | UIInterfaceOrientationLandscapeLeft 57 | UIInterfaceOrientationLandscapeRight 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Article related to this project 2 | 3 | - [Infinite List Scroll with SwiftUI and Combine](https://www.vadimbulavin.com/infinite-list-scroll-swiftui-combine/). 4 | 5 | --- 6 | 7 | # InfiniteListSwiftUI 8 | 9 | A sample project showcasing how to build an infinite list using the Combine and SwiftUI frameworks, and the MVVM iOS app architecture. 10 | 11 |

12 | Infinite List Endless Scroll Paginated List in SwiftUI and Combine 13 |

14 | -------------------------------------------------------------------------------- /demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/V8tr/InfiniteListSwiftUI/f064cab5f400911fd9602cd21490c3662889d749/demo.gif --------------------------------------------------------------------------------