├── .DS_Store ├── README.md ├── TableAnimations.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ └── xcuserdata │ │ └── shubham.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── shubham.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ └── xcschememanagement.plist └── TableAnimations ├── Animations └── TableAnimations.swift ├── AppDelegate.swift ├── Assets.xcassets ├── AppIcon.appiconset │ └── Contents.json └── Contents.json ├── Base.lproj ├── LaunchScreen.storyboard └── Main.storyboard ├── Info.plist ├── Model └── Tables.swift ├── SceneDelegate.swift ├── TableAnimationViewCell.swift ├── TableAnimationViewCell.xib └── ViewController.swift /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shubham0812/TableViewAnimations_iOS/bf90d962a5a8d077321b627198e07457b680f429/.DS_Store -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # TableViewAnimations_iOS 2 | 3 | A Tutorial to animate the TableViewCells with a TableAnimator class, it's highly customizable and has four types of animations - 4 | * Fade-In animation: Animates the tableView cells based on the alpha of the cell. 5 | * Move-Up animation: Animates the tableView cells based on the position of the cell. 6 | * Move-Up-Fade animation: Animates the tableView cells based on the position and the alpha of the cell. 7 | * Move-Up-Bounce animation: Animates the tableView cells based on the position of the cell with a spring animation. 8 | 9 | -------------------------------------------------------------------------------- /TableAnimations.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 51CD2E5324B06B760001E98F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51CD2E5224B06B760001E98F /* AppDelegate.swift */; }; 11 | 51CD2E5524B06B760001E98F /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51CD2E5424B06B760001E98F /* SceneDelegate.swift */; }; 12 | 51CD2E5724B06B760001E98F /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51CD2E5624B06B760001E98F /* ViewController.swift */; }; 13 | 51CD2E5A24B06B760001E98F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 51CD2E5824B06B760001E98F /* Main.storyboard */; }; 14 | 51CD2E5C24B06B7A0001E98F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 51CD2E5B24B06B7A0001E98F /* Assets.xcassets */; }; 15 | 51CD2E5F24B06B7A0001E98F /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 51CD2E5D24B06B7A0001E98F /* LaunchScreen.storyboard */; }; 16 | 51CD2E6824B06B960001E98F /* TableAnimations.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51CD2E6724B06B960001E98F /* TableAnimations.swift */; }; 17 | 51CD2E6C24B071960001E98F /* TableAnimationViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 51CD2E6A24B071960001E98F /* TableAnimationViewCell.xib */; }; 18 | 51CD2E6D24B071960001E98F /* TableAnimationViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51CD2E6B24B071960001E98F /* TableAnimationViewCell.swift */; }; 19 | 51CD2E7024B072870001E98F /* Tables.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51CD2E6F24B072870001E98F /* Tables.swift */; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXFileReference section */ 23 | 51CD2E4F24B06B760001E98F /* TableAnimations.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TableAnimations.app; sourceTree = BUILT_PRODUCTS_DIR; }; 24 | 51CD2E5224B06B760001E98F /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 25 | 51CD2E5424B06B760001E98F /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; 26 | 51CD2E5624B06B760001E98F /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 27 | 51CD2E5924B06B760001E98F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 28 | 51CD2E5B24B06B7A0001E98F /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 29 | 51CD2E5E24B06B7A0001E98F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 30 | 51CD2E6024B06B7A0001E98F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 31 | 51CD2E6724B06B960001E98F /* TableAnimations.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TableAnimations.swift; sourceTree = ""; }; 32 | 51CD2E6A24B071960001E98F /* TableAnimationViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = TableAnimationViewCell.xib; sourceTree = ""; }; 33 | 51CD2E6B24B071960001E98F /* TableAnimationViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableAnimationViewCell.swift; sourceTree = ""; }; 34 | 51CD2E6F24B072870001E98F /* Tables.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Tables.swift; sourceTree = ""; }; 35 | /* End PBXFileReference section */ 36 | 37 | /* Begin PBXFrameworksBuildPhase section */ 38 | 51CD2E4C24B06B760001E98F /* Frameworks */ = { 39 | isa = PBXFrameworksBuildPhase; 40 | buildActionMask = 2147483647; 41 | files = ( 42 | ); 43 | runOnlyForDeploymentPostprocessing = 0; 44 | }; 45 | /* End PBXFrameworksBuildPhase section */ 46 | 47 | /* Begin PBXGroup section */ 48 | 51CD2E4624B06B760001E98F = { 49 | isa = PBXGroup; 50 | children = ( 51 | 51CD2E5124B06B760001E98F /* TableAnimations */, 52 | 51CD2E5024B06B760001E98F /* Products */, 53 | ); 54 | sourceTree = ""; 55 | }; 56 | 51CD2E5024B06B760001E98F /* Products */ = { 57 | isa = PBXGroup; 58 | children = ( 59 | 51CD2E4F24B06B760001E98F /* TableAnimations.app */, 60 | ); 61 | name = Products; 62 | sourceTree = ""; 63 | }; 64 | 51CD2E5124B06B760001E98F /* TableAnimations */ = { 65 | isa = PBXGroup; 66 | children = ( 67 | 51CD2E6E24B072770001E98F /* Model */, 68 | 51CD2E6624B06B870001E98F /* Animations */, 69 | 51CD2E5224B06B760001E98F /* AppDelegate.swift */, 70 | 51CD2E5424B06B760001E98F /* SceneDelegate.swift */, 71 | 51CD2E5624B06B760001E98F /* ViewController.swift */, 72 | 51CD2E6B24B071960001E98F /* TableAnimationViewCell.swift */, 73 | 51CD2E6A24B071960001E98F /* TableAnimationViewCell.xib */, 74 | 51CD2E5824B06B760001E98F /* Main.storyboard */, 75 | 51CD2E5B24B06B7A0001E98F /* Assets.xcassets */, 76 | 51CD2E5D24B06B7A0001E98F /* LaunchScreen.storyboard */, 77 | 51CD2E6024B06B7A0001E98F /* Info.plist */, 78 | ); 79 | path = TableAnimations; 80 | sourceTree = ""; 81 | }; 82 | 51CD2E6624B06B870001E98F /* Animations */ = { 83 | isa = PBXGroup; 84 | children = ( 85 | 51CD2E6724B06B960001E98F /* TableAnimations.swift */, 86 | ); 87 | path = Animations; 88 | sourceTree = ""; 89 | }; 90 | 51CD2E6E24B072770001E98F /* Model */ = { 91 | isa = PBXGroup; 92 | children = ( 93 | 51CD2E6F24B072870001E98F /* Tables.swift */, 94 | ); 95 | path = Model; 96 | sourceTree = ""; 97 | }; 98 | /* End PBXGroup section */ 99 | 100 | /* Begin PBXNativeTarget section */ 101 | 51CD2E4E24B06B760001E98F /* TableAnimations */ = { 102 | isa = PBXNativeTarget; 103 | buildConfigurationList = 51CD2E6324B06B7A0001E98F /* Build configuration list for PBXNativeTarget "TableAnimations" */; 104 | buildPhases = ( 105 | 51CD2E4B24B06B760001E98F /* Sources */, 106 | 51CD2E4C24B06B760001E98F /* Frameworks */, 107 | 51CD2E4D24B06B760001E98F /* Resources */, 108 | ); 109 | buildRules = ( 110 | ); 111 | dependencies = ( 112 | ); 113 | name = TableAnimations; 114 | productName = TableAnimations; 115 | productReference = 51CD2E4F24B06B760001E98F /* TableAnimations.app */; 116 | productType = "com.apple.product-type.application"; 117 | }; 118 | /* End PBXNativeTarget section */ 119 | 120 | /* Begin PBXProject section */ 121 | 51CD2E4724B06B760001E98F /* Project object */ = { 122 | isa = PBXProject; 123 | attributes = { 124 | LastSwiftUpdateCheck = 1150; 125 | LastUpgradeCheck = 1150; 126 | ORGANIZATIONNAME = "Shubham Singh"; 127 | TargetAttributes = { 128 | 51CD2E4E24B06B760001E98F = { 129 | CreatedOnToolsVersion = 11.5; 130 | }; 131 | }; 132 | }; 133 | buildConfigurationList = 51CD2E4A24B06B760001E98F /* Build configuration list for PBXProject "TableAnimations" */; 134 | compatibilityVersion = "Xcode 9.3"; 135 | developmentRegion = en; 136 | hasScannedForEncodings = 0; 137 | knownRegions = ( 138 | en, 139 | Base, 140 | ); 141 | mainGroup = 51CD2E4624B06B760001E98F; 142 | productRefGroup = 51CD2E5024B06B760001E98F /* Products */; 143 | projectDirPath = ""; 144 | projectRoot = ""; 145 | targets = ( 146 | 51CD2E4E24B06B760001E98F /* TableAnimations */, 147 | ); 148 | }; 149 | /* End PBXProject section */ 150 | 151 | /* Begin PBXResourcesBuildPhase section */ 152 | 51CD2E4D24B06B760001E98F /* Resources */ = { 153 | isa = PBXResourcesBuildPhase; 154 | buildActionMask = 2147483647; 155 | files = ( 156 | 51CD2E5F24B06B7A0001E98F /* LaunchScreen.storyboard in Resources */, 157 | 51CD2E5C24B06B7A0001E98F /* Assets.xcassets in Resources */, 158 | 51CD2E6C24B071960001E98F /* TableAnimationViewCell.xib in Resources */, 159 | 51CD2E5A24B06B760001E98F /* Main.storyboard in Resources */, 160 | ); 161 | runOnlyForDeploymentPostprocessing = 0; 162 | }; 163 | /* End PBXResourcesBuildPhase section */ 164 | 165 | /* Begin PBXSourcesBuildPhase section */ 166 | 51CD2E4B24B06B760001E98F /* Sources */ = { 167 | isa = PBXSourcesBuildPhase; 168 | buildActionMask = 2147483647; 169 | files = ( 170 | 51CD2E6D24B071960001E98F /* TableAnimationViewCell.swift in Sources */, 171 | 51CD2E5724B06B760001E98F /* ViewController.swift in Sources */, 172 | 51CD2E5324B06B760001E98F /* AppDelegate.swift in Sources */, 173 | 51CD2E5524B06B760001E98F /* SceneDelegate.swift in Sources */, 174 | 51CD2E7024B072870001E98F /* Tables.swift in Sources */, 175 | 51CD2E6824B06B960001E98F /* TableAnimations.swift in Sources */, 176 | ); 177 | runOnlyForDeploymentPostprocessing = 0; 178 | }; 179 | /* End PBXSourcesBuildPhase section */ 180 | 181 | /* Begin PBXVariantGroup section */ 182 | 51CD2E5824B06B760001E98F /* Main.storyboard */ = { 183 | isa = PBXVariantGroup; 184 | children = ( 185 | 51CD2E5924B06B760001E98F /* Base */, 186 | ); 187 | name = Main.storyboard; 188 | sourceTree = ""; 189 | }; 190 | 51CD2E5D24B06B7A0001E98F /* LaunchScreen.storyboard */ = { 191 | isa = PBXVariantGroup; 192 | children = ( 193 | 51CD2E5E24B06B7A0001E98F /* Base */, 194 | ); 195 | name = LaunchScreen.storyboard; 196 | sourceTree = ""; 197 | }; 198 | /* End PBXVariantGroup section */ 199 | 200 | /* Begin XCBuildConfiguration section */ 201 | 51CD2E6124B06B7A0001E98F /* Debug */ = { 202 | isa = XCBuildConfiguration; 203 | buildSettings = { 204 | ALWAYS_SEARCH_USER_PATHS = NO; 205 | CLANG_ANALYZER_NONNULL = YES; 206 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 207 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 208 | CLANG_CXX_LIBRARY = "libc++"; 209 | CLANG_ENABLE_MODULES = YES; 210 | CLANG_ENABLE_OBJC_ARC = YES; 211 | CLANG_ENABLE_OBJC_WEAK = YES; 212 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 213 | CLANG_WARN_BOOL_CONVERSION = YES; 214 | CLANG_WARN_COMMA = YES; 215 | CLANG_WARN_CONSTANT_CONVERSION = YES; 216 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 217 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 218 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 219 | CLANG_WARN_EMPTY_BODY = YES; 220 | CLANG_WARN_ENUM_CONVERSION = YES; 221 | CLANG_WARN_INFINITE_RECURSION = YES; 222 | CLANG_WARN_INT_CONVERSION = YES; 223 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 224 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 225 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 226 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 227 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 228 | CLANG_WARN_STRICT_PROTOTYPES = YES; 229 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 230 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 231 | CLANG_WARN_UNREACHABLE_CODE = YES; 232 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 233 | COPY_PHASE_STRIP = NO; 234 | DEBUG_INFORMATION_FORMAT = dwarf; 235 | ENABLE_STRICT_OBJC_MSGSEND = YES; 236 | ENABLE_TESTABILITY = YES; 237 | GCC_C_LANGUAGE_STANDARD = gnu11; 238 | GCC_DYNAMIC_NO_PIC = NO; 239 | GCC_NO_COMMON_BLOCKS = YES; 240 | GCC_OPTIMIZATION_LEVEL = 0; 241 | GCC_PREPROCESSOR_DEFINITIONS = ( 242 | "DEBUG=1", 243 | "$(inherited)", 244 | ); 245 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 246 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 247 | GCC_WARN_UNDECLARED_SELECTOR = YES; 248 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 249 | GCC_WARN_UNUSED_FUNCTION = YES; 250 | GCC_WARN_UNUSED_VARIABLE = YES; 251 | IPHONEOS_DEPLOYMENT_TARGET = 13.5; 252 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 253 | MTL_FAST_MATH = YES; 254 | ONLY_ACTIVE_ARCH = YES; 255 | SDKROOT = iphoneos; 256 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 257 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 258 | }; 259 | name = Debug; 260 | }; 261 | 51CD2E6224B06B7A0001E98F /* Release */ = { 262 | isa = XCBuildConfiguration; 263 | buildSettings = { 264 | ALWAYS_SEARCH_USER_PATHS = NO; 265 | CLANG_ANALYZER_NONNULL = YES; 266 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 267 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 268 | CLANG_CXX_LIBRARY = "libc++"; 269 | CLANG_ENABLE_MODULES = YES; 270 | CLANG_ENABLE_OBJC_ARC = YES; 271 | CLANG_ENABLE_OBJC_WEAK = YES; 272 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 273 | CLANG_WARN_BOOL_CONVERSION = YES; 274 | CLANG_WARN_COMMA = YES; 275 | CLANG_WARN_CONSTANT_CONVERSION = YES; 276 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 277 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 278 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 279 | CLANG_WARN_EMPTY_BODY = YES; 280 | CLANG_WARN_ENUM_CONVERSION = YES; 281 | CLANG_WARN_INFINITE_RECURSION = YES; 282 | CLANG_WARN_INT_CONVERSION = YES; 283 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 284 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 285 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 286 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 287 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 288 | CLANG_WARN_STRICT_PROTOTYPES = YES; 289 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 290 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 291 | CLANG_WARN_UNREACHABLE_CODE = YES; 292 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 293 | COPY_PHASE_STRIP = NO; 294 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 295 | ENABLE_NS_ASSERTIONS = NO; 296 | ENABLE_STRICT_OBJC_MSGSEND = YES; 297 | GCC_C_LANGUAGE_STANDARD = gnu11; 298 | GCC_NO_COMMON_BLOCKS = YES; 299 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 300 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 301 | GCC_WARN_UNDECLARED_SELECTOR = YES; 302 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 303 | GCC_WARN_UNUSED_FUNCTION = YES; 304 | GCC_WARN_UNUSED_VARIABLE = YES; 305 | IPHONEOS_DEPLOYMENT_TARGET = 13.5; 306 | MTL_ENABLE_DEBUG_INFO = NO; 307 | MTL_FAST_MATH = YES; 308 | SDKROOT = iphoneos; 309 | SWIFT_COMPILATION_MODE = wholemodule; 310 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 311 | VALIDATE_PRODUCT = YES; 312 | }; 313 | name = Release; 314 | }; 315 | 51CD2E6424B06B7A0001E98F /* Debug */ = { 316 | isa = XCBuildConfiguration; 317 | buildSettings = { 318 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 319 | CODE_SIGN_STYLE = Automatic; 320 | DEVELOPMENT_TEAM = T3JUZKQX4R; 321 | INFOPLIST_FILE = TableAnimations/Info.plist; 322 | LD_RUNPATH_SEARCH_PATHS = ( 323 | "$(inherited)", 324 | "@executable_path/Frameworks", 325 | ); 326 | PRODUCT_BUNDLE_IDENTIFIER = "com.shubham-iosdev.TableAnimations"; 327 | PRODUCT_NAME = "$(TARGET_NAME)"; 328 | SWIFT_VERSION = 5.0; 329 | TARGETED_DEVICE_FAMILY = "1,2"; 330 | }; 331 | name = Debug; 332 | }; 333 | 51CD2E6524B06B7A0001E98F /* Release */ = { 334 | isa = XCBuildConfiguration; 335 | buildSettings = { 336 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 337 | CODE_SIGN_STYLE = Automatic; 338 | DEVELOPMENT_TEAM = T3JUZKQX4R; 339 | INFOPLIST_FILE = TableAnimations/Info.plist; 340 | LD_RUNPATH_SEARCH_PATHS = ( 341 | "$(inherited)", 342 | "@executable_path/Frameworks", 343 | ); 344 | PRODUCT_BUNDLE_IDENTIFIER = "com.shubham-iosdev.TableAnimations"; 345 | PRODUCT_NAME = "$(TARGET_NAME)"; 346 | SWIFT_VERSION = 5.0; 347 | TARGETED_DEVICE_FAMILY = "1,2"; 348 | }; 349 | name = Release; 350 | }; 351 | /* End XCBuildConfiguration section */ 352 | 353 | /* Begin XCConfigurationList section */ 354 | 51CD2E4A24B06B760001E98F /* Build configuration list for PBXProject "TableAnimations" */ = { 355 | isa = XCConfigurationList; 356 | buildConfigurations = ( 357 | 51CD2E6124B06B7A0001E98F /* Debug */, 358 | 51CD2E6224B06B7A0001E98F /* Release */, 359 | ); 360 | defaultConfigurationIsVisible = 0; 361 | defaultConfigurationName = Release; 362 | }; 363 | 51CD2E6324B06B7A0001E98F /* Build configuration list for PBXNativeTarget "TableAnimations" */ = { 364 | isa = XCConfigurationList; 365 | buildConfigurations = ( 366 | 51CD2E6424B06B7A0001E98F /* Debug */, 367 | 51CD2E6524B06B7A0001E98F /* Release */, 368 | ); 369 | defaultConfigurationIsVisible = 0; 370 | defaultConfigurationName = Release; 371 | }; 372 | /* End XCConfigurationList section */ 373 | }; 374 | rootObject = 51CD2E4724B06B760001E98F /* Project object */; 375 | } 376 | -------------------------------------------------------------------------------- /TableAnimations.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /TableAnimations.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /TableAnimations.xcodeproj/project.xcworkspace/xcuserdata/shubham.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shubham0812/TableViewAnimations_iOS/bf90d962a5a8d077321b627198e07457b680f429/TableAnimations.xcodeproj/project.xcworkspace/xcuserdata/shubham.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /TableAnimations.xcodeproj/xcuserdata/shubham.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | -------------------------------------------------------------------------------- /TableAnimations.xcodeproj/xcuserdata/shubham.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | TableAnimations.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /TableAnimations/Animations/TableAnimations.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TableAnimations.swift 3 | // TableAnimations 4 | // 5 | // Created by Shubham Singh on 04/07/20. 6 | // Copyright © 2020 Shubham Singh. All rights reserved. 7 | // 8 | import UIKit 9 | 10 | typealias TableCellAnimation = (UITableViewCell, IndexPath, UITableView) -> Void 11 | 12 | final class TableViewAnimator { 13 | private let animation: TableCellAnimation 14 | 15 | init(animation: @escaping TableCellAnimation) { 16 | self.animation = animation 17 | } 18 | 19 | func animate(cell: UITableViewCell, at indexPath: IndexPath, in tableView: UITableView) { 20 | animation(cell, indexPath, tableView) 21 | } 22 | } 23 | 24 | ///enums providing tableViewCell animations 25 | enum TableAnimationFactory { 26 | 27 | /// fades the cell by setting alpha as zero and then animates the cell's alpha based on indexPaths 28 | static func makeFadeAnimation(duration: TimeInterval, delayFactor: TimeInterval) -> TableCellAnimation { 29 | return { cell, indexPath, _ in 30 | cell.alpha = 0 31 | UIView.animate( 32 | withDuration: duration, 33 | delay: delayFactor * Double(indexPath.row), 34 | animations: { 35 | cell.alpha = 1 36 | }) 37 | } 38 | } 39 | 40 | /// fades the cell by setting alpha as zero and moves the cell downwards, then animates the cell's alpha and returns it to it's original position based on indexPaths 41 | static func makeMoveUpWithFadeAnimation(rowHeight: CGFloat, duration: TimeInterval, delayFactor: TimeInterval) -> TableCellAnimation { 42 | return { cell, indexPath, _ in 43 | cell.transform = CGAffineTransform(translationX: 0, y: rowHeight * 1.4) 44 | cell.alpha = 0 45 | UIView.animate( 46 | withDuration: duration, 47 | delay: delayFactor * Double(indexPath.row), 48 | options: [.curveEaseInOut], 49 | animations: { 50 | cell.transform = CGAffineTransform(translationX: 0, y: 0) 51 | cell.alpha = 1 52 | }) 53 | } 54 | } 55 | 56 | /// moves the cell downwards, then animates the cell's by returning them to their original position based on indexPaths 57 | static func makeMoveUpAnimation(rowHeight: CGFloat, duration: TimeInterval, delayFactor: TimeInterval) -> TableCellAnimation { 58 | return { cell, indexPath, _ in 59 | cell.transform = CGAffineTransform(translationX: 0, y: rowHeight * 1.4) 60 | UIView.animate( 61 | withDuration: duration, 62 | delay: delayFactor * Double(indexPath.row), 63 | options: [.curveEaseInOut], 64 | animations: { 65 | cell.transform = CGAffineTransform(translationX: 0, y: 0) 66 | }) 67 | } 68 | } 69 | 70 | /// moves the cell downwards, then animates the cell's by returning them to their original position with spring bounce based on indexPaths 71 | static func makeMoveUpBounceAnimation(rowHeight: CGFloat, duration: TimeInterval, delayFactor: Double) -> TableCellAnimation { 72 | return { cell, indexPath, tableView in 73 | cell.transform = CGAffineTransform(translationX: 0, y: rowHeight) 74 | UIView.animate( 75 | withDuration: duration, 76 | delay: delayFactor * Double(indexPath.row), 77 | usingSpringWithDamping: 0.6, 78 | initialSpringVelocity: 0.1, 79 | options: [.curveEaseInOut], 80 | animations: { 81 | cell.transform = CGAffineTransform(translationX: 0, y: 0) 82 | }) 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /TableAnimations/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // TableAnimations 4 | // 5 | // Created by Shubham Singh on 04/07/20. 6 | // Copyright © 2020 Shubham Singh. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | 15 | 16 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 17 | // Override point for customization after application launch. 18 | return true 19 | } 20 | 21 | // MARK: UISceneSession Lifecycle 22 | 23 | func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { 24 | // Called when a new scene session is being created. 25 | // Use this method to select a configuration to create the new scene with. 26 | return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) 27 | } 28 | 29 | func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) { 30 | // Called when the user discards a scene session. 31 | // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. 32 | // Use this method to release any resources that were specific to the discarded scenes, as they will not return. 33 | } 34 | 35 | 36 | } 37 | 38 | -------------------------------------------------------------------------------- /TableAnimations/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 | -------------------------------------------------------------------------------- /TableAnimations/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /TableAnimations/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 | -------------------------------------------------------------------------------- /TableAnimations/Base.lproj/Main.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 | 38 | 51 | 64 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /TableAnimations/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 | UISceneStoryboardFile 37 | Main 38 | 39 | 40 | 41 | 42 | UILaunchStoryboardName 43 | LaunchScreen 44 | UIMainStoryboardFile 45 | Main 46 | UIRequiredDeviceCapabilities 47 | 48 | armv7 49 | 50 | UISupportedInterfaceOrientations 51 | 52 | UIInterfaceOrientationPortrait 53 | UIInterfaceOrientationLandscapeLeft 54 | UIInterfaceOrientationLandscapeRight 55 | 56 | UISupportedInterfaceOrientations~ipad 57 | 58 | UIInterfaceOrientationPortrait 59 | UIInterfaceOrientationPortraitUpsideDown 60 | UIInterfaceOrientationLandscapeLeft 61 | UIInterfaceOrientationLandscapeRight 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /TableAnimations/Model/Tables.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Tables.swift 3 | // Animatify 4 | // 5 | // Created by Shubham Singh on 20/06/20. 6 | // Copyright © 2020 Shubham Singh. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | /// Enum provider for providing the animationTitle and an animation method from the factory 12 | enum TableAnimation { 13 | case fadeIn(duration: TimeInterval, delay: TimeInterval) 14 | case moveUp(rowHeight: CGFloat, duration: TimeInterval, delay: TimeInterval) 15 | case moveUpWithFade(rowHeight: CGFloat, duration: TimeInterval, delay: TimeInterval) 16 | case moveUpBounce(rowHeight: CGFloat, duration: TimeInterval, delay: TimeInterval) 17 | 18 | // provides an animation with duration and delay associated with the case 19 | func getAnimation() -> TableCellAnimation { 20 | switch self { 21 | case .fadeIn(let duration, let delay): 22 | return TableAnimationFactory.makeFadeAnimation(duration: duration, delayFactor: delay) 23 | case .moveUp(let rowHeight, let duration, let delay): 24 | return TableAnimationFactory.makeMoveUpAnimation(rowHeight: rowHeight, duration: duration, delayFactor: delay) 25 | case .moveUpWithFade(let rowHeight, let duration, let delay): 26 | return TableAnimationFactory.makeMoveUpWithFadeAnimation(rowHeight: rowHeight, duration: duration, delayFactor: delay) 27 | case .moveUpBounce(let rowHeight, let duration, let delay): 28 | return TableAnimationFactory.makeMoveUpBounceAnimation(rowHeight: rowHeight, duration: duration, delayFactor: delay) 29 | } 30 | } 31 | 32 | // provides the title based on the case 33 | func getTitle() -> String { 34 | switch self { 35 | case .fadeIn(_, _): 36 | return "Fade-In Animation" 37 | case .moveUp(_, _, _): 38 | return "Move-Up Animation" 39 | case .moveUpWithFade(_, _, _): 40 | return "Move-Up-Fade Animation" 41 | case .moveUpBounce(_, _, _): 42 | return "Move-Up-Bounce Animation" 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /TableAnimations/SceneDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SceneDelegate.swift 3 | // TableAnimations 4 | // 5 | // Created by Shubham Singh on 04/07/20. 6 | // Copyright © 2020 Shubham Singh. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class SceneDelegate: UIResponder, UIWindowSceneDelegate { 12 | 13 | var window: UIWindow? 14 | 15 | 16 | func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { 17 | // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. 18 | // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. 19 | // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). 20 | guard let _ = (scene as? UIWindowScene) else { return } 21 | } 22 | 23 | func sceneDidDisconnect(_ scene: UIScene) { 24 | // Called as the scene is being released by the system. 25 | // This occurs shortly after the scene enters the background, or when its session is discarded. 26 | // Release any resources associated with this scene that can be re-created the next time the scene connects. 27 | // The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead). 28 | } 29 | 30 | func sceneDidBecomeActive(_ scene: UIScene) { 31 | // Called when the scene has moved from an inactive state to an active state. 32 | // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. 33 | } 34 | 35 | func sceneWillResignActive(_ scene: UIScene) { 36 | // Called when the scene will move from an active state to an inactive state. 37 | // This may occur due to temporary interruptions (ex. an incoming phone call). 38 | } 39 | 40 | func sceneWillEnterForeground(_ scene: UIScene) { 41 | // Called as the scene transitions from the background to the foreground. 42 | // Use this method to undo the changes made on entering the background. 43 | } 44 | 45 | func sceneDidEnterBackground(_ scene: UIScene) { 46 | // Called as the scene transitions from the foreground to the background. 47 | // Use this method to save data, release shared resources, and store enough scene-specific state information 48 | // to restore the scene back to its current state. 49 | } 50 | 51 | 52 | } 53 | 54 | -------------------------------------------------------------------------------- /TableAnimations/TableAnimationViewCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TableAnimationViewCell.swift 3 | // Animatify 4 | // 5 | // Created by Shubham Singh on 20/06/20. 6 | // Copyright © 2020 Shubham Singh. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class TableAnimationViewCell: UITableViewCell { 12 | override class func description() -> String { 13 | return "TableAnimationViewCell" 14 | } 15 | 16 | // MARK:- outlets for the viewController 17 | @IBOutlet weak var containerView: UIView! 18 | 19 | // properties for the tableViewCell 20 | var tableViewHeight: CGFloat = 62 21 | var color = UIColor.white { 22 | didSet { 23 | self.containerView.backgroundColor = color 24 | } 25 | } 26 | 27 | override func awakeFromNib() { 28 | super.awakeFromNib() 29 | self.selectionStyle = .none 30 | self.containerView.layer.cornerRadius = 4 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /TableAnimations/TableAnimationViewCell.xib: -------------------------------------------------------------------------------- 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 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /TableAnimations/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // TableAnimations 4 | // 5 | // Created by Shubham Singh on 04/07/20. 6 | // Copyright © 2020 Shubham Singh. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource { 12 | 13 | // MARK:- outlets for the viewController 14 | @IBOutlet weak var tableView: UITableView! 15 | @IBOutlet weak var button1: UIButton! 16 | @IBOutlet weak var button2: UIButton! 17 | @IBOutlet weak var button3: UIButton! 18 | @IBOutlet weak var button4: UIButton! 19 | 20 | // MARK:- variables for the viewController 21 | var colors = [UIColor.systemRed, UIColor.systemBlue, UIColor.systemOrange, 22 | UIColor.systemPurple,UIColor.systemGreen] 23 | var tableViewHeaderText = "" 24 | 25 | /// an enum of type TableAnimation - determines the animation to be applied to the tableViewCells 26 | var currentTableAnimation: TableAnimation = .fadeIn(duration: 0.85, delay: 0.03) { 27 | didSet { 28 | self.tableViewHeaderText = currentTableAnimation.getTitle() 29 | } 30 | } 31 | var animationDuration: TimeInterval = 0.85 32 | var delay: TimeInterval = 0.05 33 | var fontSize: CGFloat = 26 34 | 35 | // MARK:- lifecycle methods for the ViewController 36 | override func viewDidLoad() { 37 | super.viewDidLoad() 38 | self.colors.append(contentsOf: colors.shuffled()) 39 | 40 | // registering the tableView 41 | self.tableView.register(UINib(nibName: TableAnimationViewCell.description(), bundle: nil), forCellReuseIdentifier: TableAnimationViewCell.description()) 42 | self.tableView.delegate = self 43 | self.tableView.dataSource = self 44 | self.tableView.isHidden = true 45 | 46 | // set the separatorStyle to none and set the Title for the tableView 47 | self.tableView.separatorStyle = .none 48 | self.tableViewHeaderText = self.currentTableAnimation.getTitle() 49 | 50 | // set the button1 as selected and reload the data of the tableView to see the animation 51 | button1.setImage(UIImage(systemName: "1.circle.fill", withConfiguration: UIImage.SymbolConfiguration(pointSize: fontSize, weight: .semibold, scale: .large)), for: .normal) 52 | DispatchQueue.main.asyncAfter(deadline: .now()) { 53 | self.tableView.isHidden = false 54 | self.tableView.reloadData() 55 | } 56 | } 57 | 58 | // delegate functions for the tableView 59 | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 60 | return colors.count 61 | } 62 | 63 | func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { 64 | return TableAnimationViewCell().tableViewHeight 65 | } 66 | 67 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 68 | if let cell = tableView.dequeueReusableCell(withIdentifier: TableAnimationViewCell.description(), for: indexPath) as? TableAnimationViewCell { 69 | cell.color = colors[indexPath.row] 70 | return cell 71 | } 72 | fatalError() 73 | } 74 | 75 | // for displaying the headerTitle for the tableView 76 | func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { 77 | let headerView = UIView(frame: CGRect.init(x: 0, y: 0, width: tableView.frame.width, height: 42)) 78 | headerView.backgroundColor = UIColor.systemBackground 79 | 80 | let label = UILabel() 81 | label.frame = CGRect(x: 24, y: 12, width: self.view.frame.width, height: 42) 82 | label.text = tableViewHeaderText 83 | label.textColor = UIColor.label 84 | label.font = UIFont.systemFont(ofSize: 26, weight: .medium) 85 | headerView.addSubview(label) 86 | return headerView 87 | } 88 | 89 | func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { 90 | return 72 91 | } 92 | 93 | // 94 | func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) { 95 | // fetch the animation from the TableAnimation enum and initialze the TableViewAnimator class 96 | let animation = currentTableAnimation.getAnimation() 97 | let animator = TableViewAnimator(animation: animation) 98 | animator.animate(cell: cell, at: indexPath, in: tableView) 99 | } 100 | 101 | 102 | // MARK:- outlet functions for the viewController 103 | @IBAction func animationButtonPressed(_ sender: Any) { 104 | guard let senderButton = sender as? UIButton else { return } 105 | 106 | /// set the buttons symbol to the default unselected circle 107 | button1.setImage(UIImage(systemName: "1.circle", withConfiguration: UIImage.SymbolConfiguration(pointSize: fontSize, weight: .semibold, scale: .large)), for: .normal) 108 | button2.setImage(UIImage(systemName: "2.circle", withConfiguration: UIImage.SymbolConfiguration(pointSize: fontSize, weight: .semibold, scale: .large)), for: .normal) 109 | button3.setImage(UIImage(systemName: "3.circle", withConfiguration: UIImage.SymbolConfiguration(pointSize: fontSize, weight: .semibold, scale: .large)), for: .normal) 110 | button4.setImage(UIImage(systemName: "4.circle", withConfiguration: UIImage.SymbolConfiguration(pointSize: fontSize, weight: .semibold, scale: .large)), for: .normal) 111 | 112 | /// based on the tag of the button, set the symbol of the associated button to show it's selected and set the currentTableAnimation. 113 | switch senderButton.tag { 114 | case 1: senderButton.setImage(UIImage(systemName: "1.circle.fill", withConfiguration: UIImage.SymbolConfiguration(pointSize: fontSize, weight: .semibold, scale: .large)), for: .normal) 115 | currentTableAnimation = TableAnimation.fadeIn(duration: animationDuration, delay: delay) 116 | case 2: senderButton.setImage(UIImage(systemName: "2.circle.fill", withConfiguration: UIImage.SymbolConfiguration(pointSize: fontSize, weight: .semibold, scale: .large)), for: .normal) 117 | currentTableAnimation = TableAnimation.moveUp(rowHeight: TableAnimationViewCell().tableViewHeight, duration: animationDuration, delay: delay) 118 | case 3: senderButton.setImage(UIImage(systemName: "3.circle.fill", withConfiguration: UIImage.SymbolConfiguration(pointSize: fontSize, weight: .semibold, scale: .large)), for: .normal) 119 | currentTableAnimation = TableAnimation.moveUpWithFade(rowHeight: TableAnimationViewCell().tableViewHeight, duration: animationDuration, delay: delay) 120 | case 4: senderButton.setImage(UIImage(systemName: "4.circle.fill", withConfiguration: UIImage.SymbolConfiguration(pointSize: fontSize, weight: .semibold, scale: .large)), for: .normal) 121 | currentTableAnimation = TableAnimation.moveUpBounce(rowHeight: TableAnimationViewCell().tableViewHeight, duration: animationDuration + 0.2, delay: delay) 122 | default: break 123 | } 124 | 125 | /// reloading the tableView to see the animation 126 | self.tableView.reloadData() 127 | } 128 | } 129 | 130 | --------------------------------------------------------------------------------