├── .gitignore ├── CustomTransitionTutorial.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── xcuserdata │ └── tung.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist ├── CustomTransitionTutorial ├── App │ ├── AppDelegate.swift │ └── SceneDelegate.swift ├── Classes │ └── ViewControllers │ │ ├── Animator.swift │ │ ├── First │ │ ├── CollectionViewCell.swift │ │ ├── FirstViewController+CollectionView.swift │ │ ├── FirstViewController+TransitioningDelegate.swift │ │ └── FirstViewController.swift │ │ └── Second │ │ └── SecondViewController.swift └── Resources │ ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ ├── Contents.json │ ├── cross.imageset │ │ ├── Contents.json │ │ └── iconfinder_cross-24_103181.png │ └── images │ │ ├── 1.imageset │ │ ├── Contents.json │ │ └── rsz_dji_0065.png │ │ ├── 2.imageset │ │ ├── Contents.json │ │ └── photo_2019-11-10 16.27.10.jpeg │ │ ├── 3.imageset │ │ ├── Contents.json │ │ └── photo_2019-11-10 16.27.12.jpeg │ │ ├── 4.imageset │ │ ├── Contents.json │ │ └── photo_2019-11-10 16.27.13.jpeg │ │ ├── 5.imageset │ │ ├── Contents.json │ │ └── photo_2019-11-10 16.27.18.jpeg │ │ ├── 6.imageset │ │ ├── Contents.json │ │ └── photo_2019-11-10 16.27.16.jpeg │ │ ├── 7.imageset │ │ ├── Contents.json │ │ └── photo_2019-11-10 16.27.15.jpeg │ │ ├── 8.imageset │ │ ├── Contents.json │ │ └── photo_2019-11-10 16.27.15 (1).jpeg │ │ └── Contents.json │ ├── Base.lproj │ └── LaunchScreen.storyboard │ ├── DataManager.swift │ ├── Info.plist │ └── Main.storyboard ├── README.md └── Supporting materials ├── CustomTransitionTutorial-Starter.zip └── demo.gif /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xccheckout 23 | *.xcscmblueprint 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | *.ipa 28 | *.dSYM.zip 29 | *.dSYM 30 | 31 | ## Playgrounds 32 | timeline.xctimeline 33 | playground.xcworkspace 34 | 35 | # Swift Package Manager 36 | # 37 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 38 | # Packages/ 39 | # Package.pins 40 | # Package.resolved 41 | .build/ 42 | 43 | # CocoaPods 44 | # 45 | # We recommend against adding the Pods directory to your .gitignore. However 46 | # you should judge for yourself, the pros and cons are mentioned at: 47 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 48 | # 49 | # Pods/ 50 | 51 | # Carthage 52 | # 53 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 54 | # Carthage/Checkouts 55 | 56 | Carthage/Build 57 | 58 | # fastlane 59 | # 60 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 61 | # screenshots whenever they are needed. 62 | # For more information about the recommended setup visit: 63 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 64 | 65 | fastlane/report.xml 66 | fastlane/Preview.html 67 | fastlane/screenshots/**/*.png 68 | fastlane/test_output 69 | -------------------------------------------------------------------------------- /CustomTransitionTutorial.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | A60A36C6238EA4ED0053E976 /* FirstViewController+CollectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A60A36C5238EA4ED0053E976 /* FirstViewController+CollectionView.swift */; }; 11 | A60A36C8238EA59C0053E976 /* FirstViewController+TransitioningDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A60A36C7238EA59C0053E976 /* FirstViewController+TransitioningDelegate.swift */; }; 12 | A60A36CA238EA5D60053E976 /* Animator.swift in Sources */ = {isa = PBXBuildFile; fileRef = A60A36C9238EA5D60053E976 /* Animator.swift */; }; 13 | A64F53392378BF880072A05D /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A64F53382378BF880072A05D /* AppDelegate.swift */; }; 14 | A64F533B2378BF880072A05D /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A64F533A2378BF880072A05D /* SceneDelegate.swift */; }; 15 | A64F53422378BF8B0072A05D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A64F53412378BF8B0072A05D /* Assets.xcassets */; }; 16 | A64F53452378BF8B0072A05D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A64F53432378BF8B0072A05D /* LaunchScreen.storyboard */; }; 17 | A64F534D2378C0D50072A05D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A64F534C2378C0D50072A05D /* Main.storyboard */; }; 18 | A64F53512378C10D0072A05D /* FirstViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A64F534E2378C10D0072A05D /* FirstViewController.swift */; }; 19 | A64F53522378C10D0072A05D /* CollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A64F534F2378C10D0072A05D /* CollectionViewCell.swift */; }; 20 | A64F53532378C10D0072A05D /* SecondViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A64F53502378C10D0072A05D /* SecondViewController.swift */; }; 21 | A64F53552378C16F0072A05D /* DataManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = A64F53542378C16F0072A05D /* DataManager.swift */; }; 22 | /* End PBXBuildFile section */ 23 | 24 | /* Begin PBXFileReference section */ 25 | A60A36C5238EA4ED0053E976 /* FirstViewController+CollectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "FirstViewController+CollectionView.swift"; sourceTree = ""; }; 26 | A60A36C7238EA59C0053E976 /* FirstViewController+TransitioningDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "FirstViewController+TransitioningDelegate.swift"; sourceTree = ""; }; 27 | A60A36C9238EA5D60053E976 /* Animator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Animator.swift; sourceTree = ""; }; 28 | A64F53352378BF880072A05D /* CustomTransitionTutorial.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CustomTransitionTutorial.app; sourceTree = BUILT_PRODUCTS_DIR; }; 29 | A64F53382378BF880072A05D /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 30 | A64F533A2378BF880072A05D /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; 31 | A64F53412378BF8B0072A05D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 32 | A64F53442378BF8B0072A05D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 33 | A64F53462378BF8B0072A05D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 34 | A64F534C2378C0D50072A05D /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = ""; }; 35 | A64F534E2378C10D0072A05D /* FirstViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FirstViewController.swift; sourceTree = ""; }; 36 | A64F534F2378C10D0072A05D /* CollectionViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CollectionViewCell.swift; sourceTree = ""; }; 37 | A64F53502378C10D0072A05D /* SecondViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SecondViewController.swift; sourceTree = ""; }; 38 | A64F53542378C16F0072A05D /* DataManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DataManager.swift; sourceTree = ""; }; 39 | /* End PBXFileReference section */ 40 | 41 | /* Begin PBXFrameworksBuildPhase section */ 42 | A64F53322378BF880072A05D /* Frameworks */ = { 43 | isa = PBXFrameworksBuildPhase; 44 | buildActionMask = 2147483647; 45 | files = ( 46 | ); 47 | runOnlyForDeploymentPostprocessing = 0; 48 | }; 49 | /* End PBXFrameworksBuildPhase section */ 50 | 51 | /* Begin PBXGroup section */ 52 | A60A36BF238E84390053E976 /* App */ = { 53 | isa = PBXGroup; 54 | children = ( 55 | A64F53382378BF880072A05D /* AppDelegate.swift */, 56 | A64F533A2378BF880072A05D /* SceneDelegate.swift */, 57 | ); 58 | path = App; 59 | sourceTree = ""; 60 | }; 61 | A60A36C0238E84430053E976 /* Resources */ = { 62 | isa = PBXGroup; 63 | children = ( 64 | A64F53542378C16F0072A05D /* DataManager.swift */, 65 | A64F534C2378C0D50072A05D /* Main.storyboard */, 66 | A64F53412378BF8B0072A05D /* Assets.xcassets */, 67 | A64F53432378BF8B0072A05D /* LaunchScreen.storyboard */, 68 | A64F53462378BF8B0072A05D /* Info.plist */, 69 | ); 70 | path = Resources; 71 | sourceTree = ""; 72 | }; 73 | A60A36C1238E84AB0053E976 /* Classes */ = { 74 | isa = PBXGroup; 75 | children = ( 76 | A60A36C2238E84BA0053E976 /* ViewControllers */, 77 | ); 78 | path = Classes; 79 | sourceTree = ""; 80 | }; 81 | A60A36C2238E84BA0053E976 /* ViewControllers */ = { 82 | isa = PBXGroup; 83 | children = ( 84 | A60A36C9238EA5D60053E976 /* Animator.swift */, 85 | A60A36C3238EA4D20053E976 /* First */, 86 | A60A36C4238EA4D70053E976 /* Second */, 87 | ); 88 | path = ViewControllers; 89 | sourceTree = ""; 90 | }; 91 | A60A36C3238EA4D20053E976 /* First */ = { 92 | isa = PBXGroup; 93 | children = ( 94 | A64F534E2378C10D0072A05D /* FirstViewController.swift */, 95 | A60A36C5238EA4ED0053E976 /* FirstViewController+CollectionView.swift */, 96 | A60A36C7238EA59C0053E976 /* FirstViewController+TransitioningDelegate.swift */, 97 | A64F534F2378C10D0072A05D /* CollectionViewCell.swift */, 98 | ); 99 | path = First; 100 | sourceTree = ""; 101 | }; 102 | A60A36C4238EA4D70053E976 /* Second */ = { 103 | isa = PBXGroup; 104 | children = ( 105 | A64F53502378C10D0072A05D /* SecondViewController.swift */, 106 | ); 107 | path = Second; 108 | sourceTree = ""; 109 | }; 110 | A64F532C2378BF880072A05D = { 111 | isa = PBXGroup; 112 | children = ( 113 | A64F53372378BF880072A05D /* CustomTransitionTutorial */, 114 | A64F53362378BF880072A05D /* Products */, 115 | ); 116 | sourceTree = ""; 117 | }; 118 | A64F53362378BF880072A05D /* Products */ = { 119 | isa = PBXGroup; 120 | children = ( 121 | A64F53352378BF880072A05D /* CustomTransitionTutorial.app */, 122 | ); 123 | name = Products; 124 | sourceTree = ""; 125 | }; 126 | A64F53372378BF880072A05D /* CustomTransitionTutorial */ = { 127 | isa = PBXGroup; 128 | children = ( 129 | A60A36BF238E84390053E976 /* App */, 130 | A60A36C1238E84AB0053E976 /* Classes */, 131 | A60A36C0238E84430053E976 /* Resources */, 132 | ); 133 | path = CustomTransitionTutorial; 134 | sourceTree = ""; 135 | }; 136 | /* End PBXGroup section */ 137 | 138 | /* Begin PBXNativeTarget section */ 139 | A64F53342378BF880072A05D /* CustomTransitionTutorial */ = { 140 | isa = PBXNativeTarget; 141 | buildConfigurationList = A64F53492378BF8B0072A05D /* Build configuration list for PBXNativeTarget "CustomTransitionTutorial" */; 142 | buildPhases = ( 143 | A64F53312378BF880072A05D /* Sources */, 144 | A64F53322378BF880072A05D /* Frameworks */, 145 | A64F53332378BF880072A05D /* Resources */, 146 | ); 147 | buildRules = ( 148 | ); 149 | dependencies = ( 150 | ); 151 | name = CustomTransitionTutorial; 152 | productName = CustomTransitionTutorial; 153 | productReference = A64F53352378BF880072A05D /* CustomTransitionTutorial.app */; 154 | productType = "com.apple.product-type.application"; 155 | }; 156 | /* End PBXNativeTarget section */ 157 | 158 | /* Begin PBXProject section */ 159 | A64F532D2378BF880072A05D /* Project object */ = { 160 | isa = PBXProject; 161 | attributes = { 162 | LastSwiftUpdateCheck = 1110; 163 | LastUpgradeCheck = 1110; 164 | ORGANIZATIONNAME = Tung; 165 | TargetAttributes = { 166 | A64F53342378BF880072A05D = { 167 | CreatedOnToolsVersion = 11.1; 168 | }; 169 | }; 170 | }; 171 | buildConfigurationList = A64F53302378BF880072A05D /* Build configuration list for PBXProject "CustomTransitionTutorial" */; 172 | compatibilityVersion = "Xcode 9.3"; 173 | developmentRegion = en; 174 | hasScannedForEncodings = 0; 175 | knownRegions = ( 176 | en, 177 | Base, 178 | ); 179 | mainGroup = A64F532C2378BF880072A05D; 180 | productRefGroup = A64F53362378BF880072A05D /* Products */; 181 | projectDirPath = ""; 182 | projectRoot = ""; 183 | targets = ( 184 | A64F53342378BF880072A05D /* CustomTransitionTutorial */, 185 | ); 186 | }; 187 | /* End PBXProject section */ 188 | 189 | /* Begin PBXResourcesBuildPhase section */ 190 | A64F53332378BF880072A05D /* Resources */ = { 191 | isa = PBXResourcesBuildPhase; 192 | buildActionMask = 2147483647; 193 | files = ( 194 | A64F534D2378C0D50072A05D /* Main.storyboard in Resources */, 195 | A64F53452378BF8B0072A05D /* LaunchScreen.storyboard in Resources */, 196 | A64F53422378BF8B0072A05D /* Assets.xcassets in Resources */, 197 | ); 198 | runOnlyForDeploymentPostprocessing = 0; 199 | }; 200 | /* End PBXResourcesBuildPhase section */ 201 | 202 | /* Begin PBXSourcesBuildPhase section */ 203 | A64F53312378BF880072A05D /* Sources */ = { 204 | isa = PBXSourcesBuildPhase; 205 | buildActionMask = 2147483647; 206 | files = ( 207 | A60A36C8238EA59C0053E976 /* FirstViewController+TransitioningDelegate.swift in Sources */, 208 | A64F53532378C10D0072A05D /* SecondViewController.swift in Sources */, 209 | A64F53522378C10D0072A05D /* CollectionViewCell.swift in Sources */, 210 | A64F53392378BF880072A05D /* AppDelegate.swift in Sources */, 211 | A64F533B2378BF880072A05D /* SceneDelegate.swift in Sources */, 212 | A60A36C6238EA4ED0053E976 /* FirstViewController+CollectionView.swift in Sources */, 213 | A60A36CA238EA5D60053E976 /* Animator.swift in Sources */, 214 | A64F53512378C10D0072A05D /* FirstViewController.swift in Sources */, 215 | A64F53552378C16F0072A05D /* DataManager.swift in Sources */, 216 | ); 217 | runOnlyForDeploymentPostprocessing = 0; 218 | }; 219 | /* End PBXSourcesBuildPhase section */ 220 | 221 | /* Begin PBXVariantGroup section */ 222 | A64F53432378BF8B0072A05D /* LaunchScreen.storyboard */ = { 223 | isa = PBXVariantGroup; 224 | children = ( 225 | A64F53442378BF8B0072A05D /* Base */, 226 | ); 227 | name = LaunchScreen.storyboard; 228 | sourceTree = ""; 229 | }; 230 | /* End PBXVariantGroup section */ 231 | 232 | /* Begin XCBuildConfiguration section */ 233 | A64F53472378BF8B0072A05D /* Debug */ = { 234 | isa = XCBuildConfiguration; 235 | buildSettings = { 236 | ALWAYS_SEARCH_USER_PATHS = NO; 237 | CLANG_ANALYZER_NONNULL = YES; 238 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 239 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 240 | CLANG_CXX_LIBRARY = "libc++"; 241 | CLANG_ENABLE_MODULES = YES; 242 | CLANG_ENABLE_OBJC_ARC = YES; 243 | CLANG_ENABLE_OBJC_WEAK = YES; 244 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 245 | CLANG_WARN_BOOL_CONVERSION = YES; 246 | CLANG_WARN_COMMA = YES; 247 | CLANG_WARN_CONSTANT_CONVERSION = YES; 248 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 249 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 250 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 251 | CLANG_WARN_EMPTY_BODY = YES; 252 | CLANG_WARN_ENUM_CONVERSION = YES; 253 | CLANG_WARN_INFINITE_RECURSION = YES; 254 | CLANG_WARN_INT_CONVERSION = YES; 255 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 256 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 257 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 258 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 259 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 260 | CLANG_WARN_STRICT_PROTOTYPES = YES; 261 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 262 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 263 | CLANG_WARN_UNREACHABLE_CODE = YES; 264 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 265 | COPY_PHASE_STRIP = NO; 266 | DEBUG_INFORMATION_FORMAT = dwarf; 267 | ENABLE_STRICT_OBJC_MSGSEND = YES; 268 | ENABLE_TESTABILITY = YES; 269 | GCC_C_LANGUAGE_STANDARD = gnu11; 270 | GCC_DYNAMIC_NO_PIC = NO; 271 | GCC_NO_COMMON_BLOCKS = YES; 272 | GCC_OPTIMIZATION_LEVEL = 0; 273 | GCC_PREPROCESSOR_DEFINITIONS = ( 274 | "DEBUG=1", 275 | "$(inherited)", 276 | ); 277 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 278 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 279 | GCC_WARN_UNDECLARED_SELECTOR = YES; 280 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 281 | GCC_WARN_UNUSED_FUNCTION = YES; 282 | GCC_WARN_UNUSED_VARIABLE = YES; 283 | IPHONEOS_DEPLOYMENT_TARGET = 13.1; 284 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 285 | MTL_FAST_MATH = YES; 286 | ONLY_ACTIVE_ARCH = YES; 287 | SDKROOT = iphoneos; 288 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 289 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 290 | }; 291 | name = Debug; 292 | }; 293 | A64F53482378BF8B0072A05D /* Release */ = { 294 | isa = XCBuildConfiguration; 295 | buildSettings = { 296 | ALWAYS_SEARCH_USER_PATHS = NO; 297 | CLANG_ANALYZER_NONNULL = YES; 298 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 299 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 300 | CLANG_CXX_LIBRARY = "libc++"; 301 | CLANG_ENABLE_MODULES = YES; 302 | CLANG_ENABLE_OBJC_ARC = YES; 303 | CLANG_ENABLE_OBJC_WEAK = YES; 304 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 305 | CLANG_WARN_BOOL_CONVERSION = YES; 306 | CLANG_WARN_COMMA = YES; 307 | CLANG_WARN_CONSTANT_CONVERSION = YES; 308 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 309 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 310 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 311 | CLANG_WARN_EMPTY_BODY = YES; 312 | CLANG_WARN_ENUM_CONVERSION = YES; 313 | CLANG_WARN_INFINITE_RECURSION = YES; 314 | CLANG_WARN_INT_CONVERSION = YES; 315 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 316 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 317 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 318 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 319 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 320 | CLANG_WARN_STRICT_PROTOTYPES = YES; 321 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 322 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 323 | CLANG_WARN_UNREACHABLE_CODE = YES; 324 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 325 | COPY_PHASE_STRIP = NO; 326 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 327 | ENABLE_NS_ASSERTIONS = NO; 328 | ENABLE_STRICT_OBJC_MSGSEND = YES; 329 | GCC_C_LANGUAGE_STANDARD = gnu11; 330 | GCC_NO_COMMON_BLOCKS = YES; 331 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 332 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 333 | GCC_WARN_UNDECLARED_SELECTOR = YES; 334 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 335 | GCC_WARN_UNUSED_FUNCTION = YES; 336 | GCC_WARN_UNUSED_VARIABLE = YES; 337 | IPHONEOS_DEPLOYMENT_TARGET = 13.1; 338 | MTL_ENABLE_DEBUG_INFO = NO; 339 | MTL_FAST_MATH = YES; 340 | SDKROOT = iphoneos; 341 | SWIFT_COMPILATION_MODE = wholemodule; 342 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 343 | VALIDATE_PRODUCT = YES; 344 | }; 345 | name = Release; 346 | }; 347 | A64F534A2378BF8B0072A05D /* Debug */ = { 348 | isa = XCBuildConfiguration; 349 | buildSettings = { 350 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 351 | CODE_SIGN_STYLE = Automatic; 352 | DEVELOPMENT_TEAM = ""; 353 | INFOPLIST_FILE = CustomTransitionTutorial/Resources/Info.plist; 354 | LD_RUNPATH_SEARCH_PATHS = ( 355 | "$(inherited)", 356 | "@executable_path/Frameworks", 357 | ); 358 | PRODUCT_BUNDLE_IDENTIFIER = com.tung.CustomTransitionTutorial; 359 | PRODUCT_NAME = "$(TARGET_NAME)"; 360 | SWIFT_VERSION = 5.0; 361 | TARGETED_DEVICE_FAMILY = "1,2"; 362 | }; 363 | name = Debug; 364 | }; 365 | A64F534B2378BF8B0072A05D /* Release */ = { 366 | isa = XCBuildConfiguration; 367 | buildSettings = { 368 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 369 | CODE_SIGN_STYLE = Automatic; 370 | DEVELOPMENT_TEAM = ""; 371 | INFOPLIST_FILE = CustomTransitionTutorial/Resources/Info.plist; 372 | LD_RUNPATH_SEARCH_PATHS = ( 373 | "$(inherited)", 374 | "@executable_path/Frameworks", 375 | ); 376 | PRODUCT_BUNDLE_IDENTIFIER = com.tung.CustomTransitionTutorial; 377 | PRODUCT_NAME = "$(TARGET_NAME)"; 378 | SWIFT_VERSION = 5.0; 379 | TARGETED_DEVICE_FAMILY = "1,2"; 380 | }; 381 | name = Release; 382 | }; 383 | /* End XCBuildConfiguration section */ 384 | 385 | /* Begin XCConfigurationList section */ 386 | A64F53302378BF880072A05D /* Build configuration list for PBXProject "CustomTransitionTutorial" */ = { 387 | isa = XCConfigurationList; 388 | buildConfigurations = ( 389 | A64F53472378BF8B0072A05D /* Debug */, 390 | A64F53482378BF8B0072A05D /* Release */, 391 | ); 392 | defaultConfigurationIsVisible = 0; 393 | defaultConfigurationName = Release; 394 | }; 395 | A64F53492378BF8B0072A05D /* Build configuration list for PBXNativeTarget "CustomTransitionTutorial" */ = { 396 | isa = XCConfigurationList; 397 | buildConfigurations = ( 398 | A64F534A2378BF8B0072A05D /* Debug */, 399 | A64F534B2378BF8B0072A05D /* Release */, 400 | ); 401 | defaultConfigurationIsVisible = 0; 402 | defaultConfigurationName = Release; 403 | }; 404 | /* End XCConfigurationList section */ 405 | }; 406 | rootObject = A64F532D2378BF880072A05D /* Project object */; 407 | } 408 | -------------------------------------------------------------------------------- /CustomTransitionTutorial.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /CustomTransitionTutorial.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /CustomTransitionTutorial.xcodeproj/xcuserdata/tung.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | CustomTransitionTutorial.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /CustomTransitionTutorial/App/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // CustomTransitionTutorial 4 | // 5 | // Created by Tung on 10.11.19. 6 | // Copyright © 2019 Tung. 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 | -------------------------------------------------------------------------------- /CustomTransitionTutorial/App/SceneDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SceneDelegate.swift 3 | // CustomTransitionTutorial 4 | // 5 | // Created by Tung on 10.11.19. 6 | // Copyright © 2019 Tung. 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 | -------------------------------------------------------------------------------- /CustomTransitionTutorial/Classes/ViewControllers/Animator.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Animator.swift 3 | // CustomTransitionTutorial 4 | // 5 | // Created by Tung on 27.11.19. 6 | // Copyright © 2019 Tung. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | // 8 12 | final class Animator: NSObject, UIViewControllerAnimatedTransitioning { 13 | 14 | // 9 15 | 16 | static let duration: TimeInterval = 1.25 17 | 18 | private let type: PresentationType 19 | private let firstViewController: FirstViewController 20 | private let secondViewController: SecondViewController 21 | private var selectedCellImageViewSnapshot: UIView 22 | private let cellImageViewRect: CGRect 23 | 24 | // 45 25 | private let cellLabelRect: CGRect 26 | 27 | // 10 28 | init?(type: PresentationType, firstViewController: FirstViewController, secondViewController: SecondViewController, selectedCellImageViewSnapshot: UIView) { 29 | self.type = type 30 | self.firstViewController = firstViewController 31 | self.secondViewController = secondViewController 32 | self.selectedCellImageViewSnapshot = selectedCellImageViewSnapshot 33 | 34 | guard let window = firstViewController.view.window ?? secondViewController.view.window, 35 | let selectedCell = firstViewController.selectedCell 36 | else { return nil } 37 | 38 | // 11 39 | self.cellImageViewRect = selectedCell.locationImageView.convert(selectedCell.locationImageView.bounds, to: window) 40 | 41 | // 46 42 | self.cellLabelRect = selectedCell.locationLabel.convert(selectedCell.locationLabel.bounds, to: window) 43 | } 44 | 45 | // 12 46 | func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval { 47 | return Self.duration 48 | } 49 | 50 | // 13 51 | func animateTransition(using transitionContext: UIViewControllerContextTransitioning) { 52 | // 18 53 | let containerView = transitionContext.containerView 54 | 55 | // 19 56 | guard let toView = secondViewController.view 57 | else { 58 | transitionContext.completeTransition(false) 59 | return 60 | } 61 | 62 | containerView.addSubview(toView) 63 | 64 | // 21 65 | guard 66 | let selectedCell = firstViewController.selectedCell, 67 | let window = firstViewController.view.window ?? secondViewController.view.window, 68 | let cellImageSnapshot = selectedCell.locationImageView.snapshotView(afterScreenUpdates: true), 69 | let controllerImageSnapshot = secondViewController.locationImageView.snapshotView(afterScreenUpdates: true), 70 | let cellLabelSnapshot = selectedCell.locationLabel.snapshotView(afterScreenUpdates: true), // 47 71 | let closeButtonSnapshot = secondViewController.closeButton.snapshotView(afterScreenUpdates: true) // 53 72 | else { 73 | transitionContext.completeTransition(true) 74 | return 75 | } 76 | 77 | let isPresenting = type.isPresenting 78 | 79 | // 40 80 | let backgroundView: UIView 81 | let fadeView = UIView(frame: containerView.bounds) 82 | fadeView.backgroundColor = secondViewController.view.backgroundColor 83 | 84 | // 33 85 | if isPresenting { 86 | selectedCellImageViewSnapshot = cellImageSnapshot 87 | 88 | // 41 89 | backgroundView = UIView(frame: containerView.bounds) 90 | backgroundView.addSubview(fadeView) 91 | fadeView.alpha = 0 92 | } else { 93 | backgroundView = firstViewController.view.snapshotView(afterScreenUpdates: true) ?? fadeView 94 | backgroundView.addSubview(fadeView) 95 | } 96 | 97 | // 23 98 | toView.alpha = 0 99 | 100 | // 34 101 | // 42 102 | // 48 103 | // 54 104 | [backgroundView, selectedCellImageViewSnapshot, controllerImageSnapshot, cellLabelSnapshot, closeButtonSnapshot].forEach { containerView.addSubview($0) } 105 | 106 | // 25 107 | let controllerImageViewRect = secondViewController.locationImageView.convert(secondViewController.locationImageView.bounds, to: window) 108 | // 49 109 | let controllerLabelRect = secondViewController.locationLabel.convert(secondViewController.locationLabel.bounds, to: window) 110 | // 55 111 | let closeButtonRect = secondViewController.closeButton.convert(secondViewController.closeButton.bounds, to: window) 112 | 113 | // 35 114 | [selectedCellImageViewSnapshot, controllerImageSnapshot].forEach { 115 | $0.frame = isPresenting ? cellImageViewRect : controllerImageViewRect 116 | 117 | // 59 118 | $0.layer.cornerRadius = isPresenting ? 12 : 0 119 | $0.layer.masksToBounds = true 120 | } 121 | 122 | // 36 123 | controllerImageSnapshot.alpha = isPresenting ? 0 : 1 124 | 125 | // 37 126 | selectedCellImageViewSnapshot.alpha = isPresenting ? 1 : 0 127 | 128 | // 50 129 | cellLabelSnapshot.frame = isPresenting ? cellLabelRect : controllerLabelRect 130 | 131 | // 56 132 | closeButtonSnapshot.frame = closeButtonRect 133 | closeButtonSnapshot.alpha = isPresenting ? 0 : 1 134 | 135 | // 27 136 | UIView.animateKeyframes(withDuration: Self.duration, delay: 0, options: .calculationModeCubic, animations: { 137 | 138 | UIView.addKeyframe(withRelativeStartTime: 0, relativeDuration: 1) { 139 | // 38 140 | self.selectedCellImageViewSnapshot.frame = isPresenting ? controllerImageViewRect : self.cellImageViewRect 141 | controllerImageSnapshot.frame = isPresenting ? controllerImageViewRect : self.cellImageViewRect 142 | 143 | // 43 144 | fadeView.alpha = isPresenting ? 1 : 0 145 | 146 | // 51 147 | cellLabelSnapshot.frame = isPresenting ? controllerLabelRect : self.cellLabelRect 148 | 149 | // 60 150 | [controllerImageSnapshot, self.selectedCellImageViewSnapshot].forEach { 151 | $0.layer.cornerRadius = isPresenting ? 0 : 12 152 | } 153 | } 154 | 155 | // 39 156 | UIView.addKeyframe(withRelativeStartTime: 0, relativeDuration: 0.6) { 157 | self.selectedCellImageViewSnapshot.alpha = isPresenting ? 0 : 1 158 | controllerImageSnapshot.alpha = isPresenting ? 1 : 0 159 | } 160 | 161 | // 57 162 | UIView.addKeyframe(withRelativeStartTime: isPresenting ? 0.7 : 0, relativeDuration: 0.3) { 163 | closeButtonSnapshot.alpha = isPresenting ? 1 : 0 164 | } 165 | }, completion: { _ in 166 | // 29 167 | self.selectedCellImageViewSnapshot.removeFromSuperview() 168 | controllerImageSnapshot.removeFromSuperview() 169 | 170 | // 44 171 | backgroundView.removeFromSuperview() 172 | // 52 173 | cellLabelSnapshot.removeFromSuperview() 174 | // 58 175 | closeButtonSnapshot.removeFromSuperview() 176 | 177 | // 30 178 | toView.alpha = 1 179 | 180 | // 31 181 | transitionContext.completeTransition(true) 182 | }) 183 | } 184 | } 185 | 186 | // 14 187 | enum PresentationType { 188 | 189 | case present 190 | case dismiss 191 | 192 | var isPresenting: Bool { 193 | return self == .present 194 | } 195 | } 196 | -------------------------------------------------------------------------------- /CustomTransitionTutorial/Classes/ViewControllers/First/CollectionViewCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CollectionViewCell.swift 3 | // CustomTransitionDemo 4 | // 5 | // Created by Tung on 13.10.19. 6 | // Copyright © 2019 Tung. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | final class CollectionViewCell: UICollectionViewCell { 12 | 13 | @IBOutlet private(set) var locationImageView: UIImageView! 14 | @IBOutlet private(set) var locationLabel: UILabel! 15 | 16 | private lazy var setupOnce: Void = { 17 | contentView.layer.cornerRadius = 12.0 18 | contentView.layer.masksToBounds = true 19 | 20 | layer.shadowColor = UIColor.black.cgColor 21 | layer.shadowOffset = CGSize(width: 0, height: 1.0) 22 | layer.shadowRadius = 1.0 23 | layer.shadowOpacity = 0.2 24 | layer.masksToBounds = false 25 | layer.shadowPath = UIBezierPath(roundedRect: self.bounds, cornerRadius: self.contentView.layer.cornerRadius).cgPath 26 | }() 27 | 28 | 29 | override func layoutSubviews() { 30 | super.layoutSubviews() 31 | 32 | _ = setupOnce 33 | } 34 | 35 | func configure(with cellData: CellData) { 36 | locationImageView.image = cellData.image 37 | locationLabel.text = cellData.title 38 | } 39 | } 40 | 41 | struct CellData { 42 | 43 | let image: UIImage 44 | let title: String 45 | } 46 | -------------------------------------------------------------------------------- /CustomTransitionTutorial/Classes/ViewControllers/First/FirstViewController+CollectionView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FirstViewController+CollectionView.swift 3 | // CustomTransitionTutorial 4 | // 5 | // Created by Tung on 27.11.19. 6 | // Copyright © 2019 Tung. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension FirstViewController: UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout { 12 | 13 | func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { 14 | return DataManager.data.count 15 | } 16 | 17 | func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { 18 | let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "CollectionViewCellIdentifier", for: indexPath) as! CollectionViewCell 19 | cell.configure(with: DataManager.data[indexPath.row]) 20 | return cell 21 | } 22 | 23 | func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { 24 | // 6 25 | selectedCell = collectionView.cellForItem(at: indexPath) as? CollectionViewCell 26 | // 7 27 | selectedCellImageViewSnapshot = selectedCell?.locationImageView.snapshotView(afterScreenUpdates: false) 28 | 29 | presentSecondViewController(with: DataManager.data[indexPath.row]) 30 | } 31 | 32 | func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { 33 | let width = (collectionView.bounds.width - Constants.cellSpacing) / 2 34 | return .init(width: width, height: width) 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /CustomTransitionTutorial/Classes/ViewControllers/First/FirstViewController+TransitioningDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FirstViewController+TransitioningDelegate.swift 3 | // CustomTransitionTutorial 4 | // 5 | // Created by Tung on 27.11.19. 6 | // Copyright © 2019 Tung. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | // 1 12 | extension FirstViewController: UIViewControllerTransitioningDelegate { 13 | 14 | // 2 15 | func animationController(forPresented presented: UIViewController, presenting: UIViewController, source: UIViewController) -> UIViewControllerAnimatedTransitioning? { 16 | // 16 17 | guard let firstViewController = presenting as? FirstViewController, 18 | let secondViewController = presented as? SecondViewController, 19 | let selectedCellImageViewSnapshot = selectedCellImageViewSnapshot 20 | else { return nil } 21 | 22 | animator = Animator(type: .present, firstViewController: firstViewController, secondViewController: secondViewController, selectedCellImageViewSnapshot: selectedCellImageViewSnapshot) 23 | return animator 24 | } 25 | 26 | // 3 27 | func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? { 28 | // 17 29 | guard let secondViewController = dismissed as? SecondViewController, 30 | let selectedCellImageViewSnapshot = selectedCellImageViewSnapshot 31 | else { return nil } 32 | 33 | animator = Animator(type: .dismiss, firstViewController: self, secondViewController: secondViewController, selectedCellImageViewSnapshot: selectedCellImageViewSnapshot) 34 | return animator 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /CustomTransitionTutorial/Classes/ViewControllers/First/FirstViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FirstViewController.swift 3 | // CustomTransitionDemo 4 | // 5 | // Created by Tung on 12.10.19. 6 | // Copyright © 2019 Tung. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class FirstViewController: UIViewController { 12 | 13 | // 5 14 | var selectedCell: CollectionViewCell? 15 | var selectedCellImageViewSnapshot: UIView? 16 | 17 | @IBOutlet private var collectionView: UICollectionView! 18 | 19 | // 15 20 | var animator: Animator? 21 | 22 | override func viewDidLoad() { 23 | super.viewDidLoad() 24 | 25 | collectionView.delegate = self 26 | collectionView.dataSource = self 27 | 28 | let layout = UICollectionViewFlowLayout() 29 | layout.minimumLineSpacing = Constants.cellSpacing 30 | layout.minimumInteritemSpacing = Constants.cellSpacing 31 | 32 | collectionView.setCollectionViewLayout(layout, animated: false) 33 | } 34 | 35 | func presentSecondViewController(with data: CellData) { 36 | let secondViewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "SecondViewController") as! SecondViewController 37 | 38 | // 4 39 | secondViewController.transitioningDelegate = self 40 | 41 | secondViewController.modalPresentationStyle = .fullScreen 42 | secondViewController.data = data 43 | present(secondViewController, animated: true) 44 | } 45 | } 46 | 47 | extension FirstViewController { 48 | 49 | enum Constants { 50 | 51 | static let cellSpacing: CGFloat = 8 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /CustomTransitionTutorial/Classes/ViewControllers/Second/SecondViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SecondViewController.swift 3 | // CustomTransitionDemo 4 | // 5 | // Created by Tung on 13.10.19. 6 | // Copyright © 2019 Tung. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class SecondViewController: UIViewController { 12 | 13 | var data: CellData! 14 | 15 | @IBOutlet private(set) var locationImageView: UIImageView! 16 | @IBOutlet private(set) var locationLabel: UILabel! 17 | @IBOutlet private(set) var closeButton: UIButton! 18 | 19 | override func viewDidLoad() { 20 | super.viewDidLoad() 21 | 22 | let cross = #imageLiteral(resourceName: "cross").withRenderingMode(.alwaysTemplate) 23 | closeButton.setImage(cross, for: .normal) 24 | closeButton.tintColor = .white 25 | 26 | locationImageView.image = data.image 27 | locationLabel.text = data.title 28 | } 29 | 30 | @IBAction func close(_ sender: Any) { 31 | dismiss(animated: true) 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /CustomTransitionTutorial/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /CustomTransitionTutorial/Resources/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /CustomTransitionTutorial/Resources/Assets.xcassets/cross.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x" 10 | }, 11 | { 12 | "idiom" : "universal", 13 | "filename" : "iconfinder_cross-24_103181.png", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /CustomTransitionTutorial/Resources/Assets.xcassets/cross.imageset/iconfinder_cross-24_103181.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tungfam/CustomTransitionTutorial/71bdb80c5a377ee25b3ff2007b8a184c67f61be5/CustomTransitionTutorial/Resources/Assets.xcassets/cross.imageset/iconfinder_cross-24_103181.png -------------------------------------------------------------------------------- /CustomTransitionTutorial/Resources/Assets.xcassets/images/1.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x" 10 | }, 11 | { 12 | "idiom" : "universal", 13 | "filename" : "rsz_dji_0065.png", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /CustomTransitionTutorial/Resources/Assets.xcassets/images/1.imageset/rsz_dji_0065.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tungfam/CustomTransitionTutorial/71bdb80c5a377ee25b3ff2007b8a184c67f61be5/CustomTransitionTutorial/Resources/Assets.xcassets/images/1.imageset/rsz_dji_0065.png -------------------------------------------------------------------------------- /CustomTransitionTutorial/Resources/Assets.xcassets/images/2.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x" 10 | }, 11 | { 12 | "idiom" : "universal", 13 | "filename" : "photo_2019-11-10 16.27.10.jpeg", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /CustomTransitionTutorial/Resources/Assets.xcassets/images/2.imageset/photo_2019-11-10 16.27.10.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tungfam/CustomTransitionTutorial/71bdb80c5a377ee25b3ff2007b8a184c67f61be5/CustomTransitionTutorial/Resources/Assets.xcassets/images/2.imageset/photo_2019-11-10 16.27.10.jpeg -------------------------------------------------------------------------------- /CustomTransitionTutorial/Resources/Assets.xcassets/images/3.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x" 10 | }, 11 | { 12 | "idiom" : "universal", 13 | "filename" : "photo_2019-11-10 16.27.12.jpeg", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /CustomTransitionTutorial/Resources/Assets.xcassets/images/3.imageset/photo_2019-11-10 16.27.12.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tungfam/CustomTransitionTutorial/71bdb80c5a377ee25b3ff2007b8a184c67f61be5/CustomTransitionTutorial/Resources/Assets.xcassets/images/3.imageset/photo_2019-11-10 16.27.12.jpeg -------------------------------------------------------------------------------- /CustomTransitionTutorial/Resources/Assets.xcassets/images/4.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x" 10 | }, 11 | { 12 | "idiom" : "universal", 13 | "filename" : "photo_2019-11-10 16.27.13.jpeg", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /CustomTransitionTutorial/Resources/Assets.xcassets/images/4.imageset/photo_2019-11-10 16.27.13.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tungfam/CustomTransitionTutorial/71bdb80c5a377ee25b3ff2007b8a184c67f61be5/CustomTransitionTutorial/Resources/Assets.xcassets/images/4.imageset/photo_2019-11-10 16.27.13.jpeg -------------------------------------------------------------------------------- /CustomTransitionTutorial/Resources/Assets.xcassets/images/5.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x" 10 | }, 11 | { 12 | "idiom" : "universal", 13 | "filename" : "photo_2019-11-10 16.27.18.jpeg", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /CustomTransitionTutorial/Resources/Assets.xcassets/images/5.imageset/photo_2019-11-10 16.27.18.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tungfam/CustomTransitionTutorial/71bdb80c5a377ee25b3ff2007b8a184c67f61be5/CustomTransitionTutorial/Resources/Assets.xcassets/images/5.imageset/photo_2019-11-10 16.27.18.jpeg -------------------------------------------------------------------------------- /CustomTransitionTutorial/Resources/Assets.xcassets/images/6.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x" 10 | }, 11 | { 12 | "idiom" : "universal", 13 | "filename" : "photo_2019-11-10 16.27.16.jpeg", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /CustomTransitionTutorial/Resources/Assets.xcassets/images/6.imageset/photo_2019-11-10 16.27.16.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tungfam/CustomTransitionTutorial/71bdb80c5a377ee25b3ff2007b8a184c67f61be5/CustomTransitionTutorial/Resources/Assets.xcassets/images/6.imageset/photo_2019-11-10 16.27.16.jpeg -------------------------------------------------------------------------------- /CustomTransitionTutorial/Resources/Assets.xcassets/images/7.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x" 10 | }, 11 | { 12 | "idiom" : "universal", 13 | "filename" : "photo_2019-11-10 16.27.15.jpeg", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /CustomTransitionTutorial/Resources/Assets.xcassets/images/7.imageset/photo_2019-11-10 16.27.15.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tungfam/CustomTransitionTutorial/71bdb80c5a377ee25b3ff2007b8a184c67f61be5/CustomTransitionTutorial/Resources/Assets.xcassets/images/7.imageset/photo_2019-11-10 16.27.15.jpeg -------------------------------------------------------------------------------- /CustomTransitionTutorial/Resources/Assets.xcassets/images/8.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x" 10 | }, 11 | { 12 | "idiom" : "universal", 13 | "filename" : "photo_2019-11-10 16.27.15 (1).jpeg", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /CustomTransitionTutorial/Resources/Assets.xcassets/images/8.imageset/photo_2019-11-10 16.27.15 (1).jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tungfam/CustomTransitionTutorial/71bdb80c5a377ee25b3ff2007b8a184c67f61be5/CustomTransitionTutorial/Resources/Assets.xcassets/images/8.imageset/photo_2019-11-10 16.27.15 (1).jpeg -------------------------------------------------------------------------------- /CustomTransitionTutorial/Resources/Assets.xcassets/images/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | }, 6 | "properties" : { 7 | "provides-namespace" : true 8 | } 9 | } -------------------------------------------------------------------------------- /CustomTransitionTutorial/Resources/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 | -------------------------------------------------------------------------------- /CustomTransitionTutorial/Resources/DataManager.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DataManager.swift 3 | // CustomTransitionDemo 4 | // 5 | // Created by Tung on 10.11.19. 6 | // Copyright © 2019 Tung. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | // Yes, it's a singleton. 12 | // But it doesn't matter since this tutorial is about the Animation transition :) 13 | 14 | class DataManager { 15 | 16 | private init() {} 17 | 18 | static let data: [CellData] = [ 19 | .init(image: #imageLiteral(resourceName: "images/1"), title: "Seychelles"), 20 | .init(image: #imageLiteral(resourceName: "images/2"), title: "Königssee"), 21 | .init(image: #imageLiteral(resourceName: "images/5"), title: "Zanzibar"), 22 | .init(image: #imageLiteral(resourceName: "images/6"), title: "Serengeti"), 23 | .init(image: #imageLiteral(resourceName: "images/3"), title: "Castle"), 24 | .init(image: #imageLiteral(resourceName: "images/4"), title: "Kyiv"), 25 | .init(image: #imageLiteral(resourceName: "images/7"), title: "Munich"), 26 | .init(image: #imageLiteral(resourceName: "images/8"), title: "Lake") 27 | ] 28 | 29 | } 30 | -------------------------------------------------------------------------------- /CustomTransitionTutorial/Resources/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 | -------------------------------------------------------------------------------- /CustomTransitionTutorial/Resources/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 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 104 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Custom ViewControllers Transition Tutorial 2 | 3 | This is a project is a supporting material for the [Tutorial](https://medium.com/@tungfam/custom-uiviewcontroller-transitions-in-swift-d1677e5aa0bf) that teaches How to Implement the Custom Transition between ViewControllers in Swift. Demo is shown below. 4 | 5 | ## Demo video 6 | 7 | 8 | -------------------------------------------------------------------------------- /Supporting materials/CustomTransitionTutorial-Starter.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tungfam/CustomTransitionTutorial/71bdb80c5a377ee25b3ff2007b8a184c67f61be5/Supporting materials/CustomTransitionTutorial-Starter.zip -------------------------------------------------------------------------------- /Supporting materials/demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tungfam/CustomTransitionTutorial/71bdb80c5a377ee25b3ff2007b8a184c67f61be5/Supporting materials/demo.gif --------------------------------------------------------------------------------