├── .gitignore ├── CustomTransitionDemo ├── CustomTransitionDemo.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── CustomTransitionDemo │ ├── AppDelegate.swift │ ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── Contents.json │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Info.plist │ ├── TransitionAnimator.swift │ ├── TransitionCoordinator.swift │ └── ViewController.swift ├── LICENSE ├── README.md └── Resources └── CustomTransition.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 | -------------------------------------------------------------------------------- /CustomTransitionDemo/CustomTransitionDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 0B9FA7302111DE8500055BF6 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0B9FA72F2111DE8500055BF6 /* AppDelegate.swift */; }; 11 | 0B9FA7322111DE8500055BF6 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0B9FA7312111DE8500055BF6 /* ViewController.swift */; }; 12 | 0B9FA7352111DE8500055BF6 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0B9FA7332111DE8500055BF6 /* Main.storyboard */; }; 13 | 0B9FA7372111DE8700055BF6 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0B9FA7362111DE8700055BF6 /* Assets.xcassets */; }; 14 | 0B9FA73A2111DE8700055BF6 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0B9FA7382111DE8700055BF6 /* LaunchScreen.storyboard */; }; 15 | 0B9FA7422111DF3100055BF6 /* TransitionAnimator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0B9FA7412111DF3100055BF6 /* TransitionAnimator.swift */; }; 16 | 0B9FA7442111DF4A00055BF6 /* TransitionCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0B9FA7432111DF4A00055BF6 /* TransitionCoordinator.swift */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXFileReference section */ 20 | 0B9FA72C2111DE8500055BF6 /* CustomTransitionDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CustomTransitionDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 21 | 0B9FA72F2111DE8500055BF6 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 22 | 0B9FA7312111DE8500055BF6 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 23 | 0B9FA7342111DE8500055BF6 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 24 | 0B9FA7362111DE8700055BF6 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 25 | 0B9FA7392111DE8700055BF6 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 26 | 0B9FA73B2111DE8700055BF6 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 27 | 0B9FA7412111DF3100055BF6 /* TransitionAnimator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransitionAnimator.swift; sourceTree = ""; }; 28 | 0B9FA7432111DF4A00055BF6 /* TransitionCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransitionCoordinator.swift; sourceTree = ""; }; 29 | /* End PBXFileReference section */ 30 | 31 | /* Begin PBXFrameworksBuildPhase section */ 32 | 0B9FA7292111DE8500055BF6 /* Frameworks */ = { 33 | isa = PBXFrameworksBuildPhase; 34 | buildActionMask = 2147483647; 35 | files = ( 36 | ); 37 | runOnlyForDeploymentPostprocessing = 0; 38 | }; 39 | /* End PBXFrameworksBuildPhase section */ 40 | 41 | /* Begin PBXGroup section */ 42 | 0B9FA7232111DE8500055BF6 = { 43 | isa = PBXGroup; 44 | children = ( 45 | 0B9FA72E2111DE8500055BF6 /* CustomTransitionDemo */, 46 | 0B9FA72D2111DE8500055BF6 /* Products */, 47 | ); 48 | sourceTree = ""; 49 | }; 50 | 0B9FA72D2111DE8500055BF6 /* Products */ = { 51 | isa = PBXGroup; 52 | children = ( 53 | 0B9FA72C2111DE8500055BF6 /* CustomTransitionDemo.app */, 54 | ); 55 | name = Products; 56 | sourceTree = ""; 57 | }; 58 | 0B9FA72E2111DE8500055BF6 /* CustomTransitionDemo */ = { 59 | isa = PBXGroup; 60 | children = ( 61 | 0B9FA72F2111DE8500055BF6 /* AppDelegate.swift */, 62 | 0B9FA7312111DE8500055BF6 /* ViewController.swift */, 63 | 0B9FA7332111DE8500055BF6 /* Main.storyboard */, 64 | 0B9FA7362111DE8700055BF6 /* Assets.xcassets */, 65 | 0B9FA7382111DE8700055BF6 /* LaunchScreen.storyboard */, 66 | 0B9FA73B2111DE8700055BF6 /* Info.plist */, 67 | 0B9FA7412111DF3100055BF6 /* TransitionAnimator.swift */, 68 | 0B9FA7432111DF4A00055BF6 /* TransitionCoordinator.swift */, 69 | ); 70 | path = CustomTransitionDemo; 71 | sourceTree = ""; 72 | }; 73 | /* End PBXGroup section */ 74 | 75 | /* Begin PBXNativeTarget section */ 76 | 0B9FA72B2111DE8500055BF6 /* CustomTransitionDemo */ = { 77 | isa = PBXNativeTarget; 78 | buildConfigurationList = 0B9FA73E2111DE8700055BF6 /* Build configuration list for PBXNativeTarget "CustomTransitionDemo" */; 79 | buildPhases = ( 80 | 0B9FA7282111DE8500055BF6 /* Sources */, 81 | 0B9FA7292111DE8500055BF6 /* Frameworks */, 82 | 0B9FA72A2111DE8500055BF6 /* Resources */, 83 | ); 84 | buildRules = ( 85 | ); 86 | dependencies = ( 87 | ); 88 | name = CustomTransitionDemo; 89 | productName = CustomTransitionDemo; 90 | productReference = 0B9FA72C2111DE8500055BF6 /* CustomTransitionDemo.app */; 91 | productType = "com.apple.product-type.application"; 92 | }; 93 | /* End PBXNativeTarget section */ 94 | 95 | /* Begin PBXProject section */ 96 | 0B9FA7242111DE8500055BF6 /* Project object */ = { 97 | isa = PBXProject; 98 | attributes = { 99 | LastSwiftUpdateCheck = 0940; 100 | LastUpgradeCheck = 0940; 101 | ORGANIZATIONNAME = OpenSource; 102 | TargetAttributes = { 103 | 0B9FA72B2111DE8500055BF6 = { 104 | CreatedOnToolsVersion = 9.4; 105 | }; 106 | }; 107 | }; 108 | buildConfigurationList = 0B9FA7272111DE8500055BF6 /* Build configuration list for PBXProject "CustomTransitionDemo" */; 109 | compatibilityVersion = "Xcode 9.3"; 110 | developmentRegion = en; 111 | hasScannedForEncodings = 0; 112 | knownRegions = ( 113 | en, 114 | Base, 115 | ); 116 | mainGroup = 0B9FA7232111DE8500055BF6; 117 | productRefGroup = 0B9FA72D2111DE8500055BF6 /* Products */; 118 | projectDirPath = ""; 119 | projectRoot = ""; 120 | targets = ( 121 | 0B9FA72B2111DE8500055BF6 /* CustomTransitionDemo */, 122 | ); 123 | }; 124 | /* End PBXProject section */ 125 | 126 | /* Begin PBXResourcesBuildPhase section */ 127 | 0B9FA72A2111DE8500055BF6 /* Resources */ = { 128 | isa = PBXResourcesBuildPhase; 129 | buildActionMask = 2147483647; 130 | files = ( 131 | 0B9FA73A2111DE8700055BF6 /* LaunchScreen.storyboard in Resources */, 132 | 0B9FA7372111DE8700055BF6 /* Assets.xcassets in Resources */, 133 | 0B9FA7352111DE8500055BF6 /* Main.storyboard in Resources */, 134 | ); 135 | runOnlyForDeploymentPostprocessing = 0; 136 | }; 137 | /* End PBXResourcesBuildPhase section */ 138 | 139 | /* Begin PBXSourcesBuildPhase section */ 140 | 0B9FA7282111DE8500055BF6 /* Sources */ = { 141 | isa = PBXSourcesBuildPhase; 142 | buildActionMask = 2147483647; 143 | files = ( 144 | 0B9FA7322111DE8500055BF6 /* ViewController.swift in Sources */, 145 | 0B9FA7442111DF4A00055BF6 /* TransitionCoordinator.swift in Sources */, 146 | 0B9FA7302111DE8500055BF6 /* AppDelegate.swift in Sources */, 147 | 0B9FA7422111DF3100055BF6 /* TransitionAnimator.swift in Sources */, 148 | ); 149 | runOnlyForDeploymentPostprocessing = 0; 150 | }; 151 | /* End PBXSourcesBuildPhase section */ 152 | 153 | /* Begin PBXVariantGroup section */ 154 | 0B9FA7332111DE8500055BF6 /* Main.storyboard */ = { 155 | isa = PBXVariantGroup; 156 | children = ( 157 | 0B9FA7342111DE8500055BF6 /* Base */, 158 | ); 159 | name = Main.storyboard; 160 | sourceTree = ""; 161 | }; 162 | 0B9FA7382111DE8700055BF6 /* LaunchScreen.storyboard */ = { 163 | isa = PBXVariantGroup; 164 | children = ( 165 | 0B9FA7392111DE8700055BF6 /* Base */, 166 | ); 167 | name = LaunchScreen.storyboard; 168 | sourceTree = ""; 169 | }; 170 | /* End PBXVariantGroup section */ 171 | 172 | /* Begin XCBuildConfiguration section */ 173 | 0B9FA73C2111DE8700055BF6 /* Debug */ = { 174 | isa = XCBuildConfiguration; 175 | buildSettings = { 176 | ALWAYS_SEARCH_USER_PATHS = NO; 177 | CLANG_ANALYZER_NONNULL = YES; 178 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 179 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 180 | CLANG_CXX_LIBRARY = "libc++"; 181 | CLANG_ENABLE_MODULES = YES; 182 | CLANG_ENABLE_OBJC_ARC = YES; 183 | CLANG_ENABLE_OBJC_WEAK = YES; 184 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 185 | CLANG_WARN_BOOL_CONVERSION = YES; 186 | CLANG_WARN_COMMA = YES; 187 | CLANG_WARN_CONSTANT_CONVERSION = YES; 188 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 189 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 190 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 191 | CLANG_WARN_EMPTY_BODY = YES; 192 | CLANG_WARN_ENUM_CONVERSION = YES; 193 | CLANG_WARN_INFINITE_RECURSION = YES; 194 | CLANG_WARN_INT_CONVERSION = YES; 195 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 196 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 197 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 198 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 199 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 200 | CLANG_WARN_STRICT_PROTOTYPES = YES; 201 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 202 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 203 | CLANG_WARN_UNREACHABLE_CODE = YES; 204 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 205 | CODE_SIGN_IDENTITY = "iPhone Developer"; 206 | COPY_PHASE_STRIP = NO; 207 | DEBUG_INFORMATION_FORMAT = dwarf; 208 | ENABLE_STRICT_OBJC_MSGSEND = YES; 209 | ENABLE_TESTABILITY = YES; 210 | GCC_C_LANGUAGE_STANDARD = gnu11; 211 | GCC_DYNAMIC_NO_PIC = NO; 212 | GCC_NO_COMMON_BLOCKS = YES; 213 | GCC_OPTIMIZATION_LEVEL = 0; 214 | GCC_PREPROCESSOR_DEFINITIONS = ( 215 | "DEBUG=1", 216 | "$(inherited)", 217 | ); 218 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 219 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 220 | GCC_WARN_UNDECLARED_SELECTOR = YES; 221 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 222 | GCC_WARN_UNUSED_FUNCTION = YES; 223 | GCC_WARN_UNUSED_VARIABLE = YES; 224 | IPHONEOS_DEPLOYMENT_TARGET = 11.4; 225 | MTL_ENABLE_DEBUG_INFO = YES; 226 | ONLY_ACTIVE_ARCH = YES; 227 | SDKROOT = iphoneos; 228 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 229 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 230 | }; 231 | name = Debug; 232 | }; 233 | 0B9FA73D2111DE8700055BF6 /* Release */ = { 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 | CODE_SIGN_IDENTITY = "iPhone Developer"; 266 | COPY_PHASE_STRIP = NO; 267 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 268 | ENABLE_NS_ASSERTIONS = NO; 269 | ENABLE_STRICT_OBJC_MSGSEND = YES; 270 | GCC_C_LANGUAGE_STANDARD = gnu11; 271 | GCC_NO_COMMON_BLOCKS = YES; 272 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 273 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 274 | GCC_WARN_UNDECLARED_SELECTOR = YES; 275 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 276 | GCC_WARN_UNUSED_FUNCTION = YES; 277 | GCC_WARN_UNUSED_VARIABLE = YES; 278 | IPHONEOS_DEPLOYMENT_TARGET = 11.4; 279 | MTL_ENABLE_DEBUG_INFO = NO; 280 | SDKROOT = iphoneos; 281 | SWIFT_COMPILATION_MODE = wholemodule; 282 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 283 | VALIDATE_PRODUCT = YES; 284 | }; 285 | name = Release; 286 | }; 287 | 0B9FA73F2111DE8700055BF6 /* Debug */ = { 288 | isa = XCBuildConfiguration; 289 | buildSettings = { 290 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 291 | CODE_SIGN_STYLE = Automatic; 292 | INFOPLIST_FILE = CustomTransitionDemo/Info.plist; 293 | LD_RUNPATH_SEARCH_PATHS = ( 294 | "$(inherited)", 295 | "@executable_path/Frameworks", 296 | ); 297 | PRODUCT_BUNDLE_IDENTIFIER = com.opensource.CustomTransitionDemo; 298 | PRODUCT_NAME = "$(TARGET_NAME)"; 299 | SWIFT_VERSION = 4.0; 300 | TARGETED_DEVICE_FAMILY = "1,2"; 301 | }; 302 | name = Debug; 303 | }; 304 | 0B9FA7402111DE8700055BF6 /* Release */ = { 305 | isa = XCBuildConfiguration; 306 | buildSettings = { 307 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 308 | CODE_SIGN_STYLE = Automatic; 309 | INFOPLIST_FILE = CustomTransitionDemo/Info.plist; 310 | LD_RUNPATH_SEARCH_PATHS = ( 311 | "$(inherited)", 312 | "@executable_path/Frameworks", 313 | ); 314 | PRODUCT_BUNDLE_IDENTIFIER = com.opensource.CustomTransitionDemo; 315 | PRODUCT_NAME = "$(TARGET_NAME)"; 316 | SWIFT_VERSION = 4.0; 317 | TARGETED_DEVICE_FAMILY = "1,2"; 318 | }; 319 | name = Release; 320 | }; 321 | /* End XCBuildConfiguration section */ 322 | 323 | /* Begin XCConfigurationList section */ 324 | 0B9FA7272111DE8500055BF6 /* Build configuration list for PBXProject "CustomTransitionDemo" */ = { 325 | isa = XCConfigurationList; 326 | buildConfigurations = ( 327 | 0B9FA73C2111DE8700055BF6 /* Debug */, 328 | 0B9FA73D2111DE8700055BF6 /* Release */, 329 | ); 330 | defaultConfigurationIsVisible = 0; 331 | defaultConfigurationName = Release; 332 | }; 333 | 0B9FA73E2111DE8700055BF6 /* Build configuration list for PBXNativeTarget "CustomTransitionDemo" */ = { 334 | isa = XCConfigurationList; 335 | buildConfigurations = ( 336 | 0B9FA73F2111DE8700055BF6 /* Debug */, 337 | 0B9FA7402111DE8700055BF6 /* Release */, 338 | ); 339 | defaultConfigurationIsVisible = 0; 340 | defaultConfigurationName = Release; 341 | }; 342 | /* End XCConfigurationList section */ 343 | }; 344 | rootObject = 0B9FA7242111DE8500055BF6 /* Project object */; 345 | } 346 | -------------------------------------------------------------------------------- /CustomTransitionDemo/CustomTransitionDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /CustomTransitionDemo/CustomTransitionDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /CustomTransitionDemo/CustomTransitionDemo/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // CustomTransitionDemo 4 | // 5 | // Created by Artur Rymarz on 01.08.2018. 6 | // Copyright © 2018 OpenSource. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 18 | // Override point for customization after application launch. 19 | let backgroundView = UIView(frame: UIScreen.main.bounds) 20 | backgroundView.backgroundColor = .white 21 | 22 | window?.addSubview(backgroundView) 23 | return true 24 | } 25 | 26 | func applicationWillResignActive(_ application: UIApplication) { 27 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 28 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 29 | } 30 | 31 | func applicationDidEnterBackground(_ application: UIApplication) { 32 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 33 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 34 | } 35 | 36 | func applicationWillEnterForeground(_ application: UIApplication) { 37 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 38 | } 39 | 40 | func applicationDidBecomeActive(_ application: UIApplication) { 41 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 42 | } 43 | 44 | func applicationWillTerminate(_ application: UIApplication) { 45 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 46 | } 47 | 48 | 49 | } 50 | 51 | -------------------------------------------------------------------------------- /CustomTransitionDemo/CustomTransitionDemo/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 | } -------------------------------------------------------------------------------- /CustomTransitionDemo/CustomTransitionDemo/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /CustomTransitionDemo/CustomTransitionDemo/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 | -------------------------------------------------------------------------------- /CustomTransitionDemo/CustomTransitionDemo/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 | 26 | 27 | 28 | 29 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 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 | 99 | 100 | 101 | -------------------------------------------------------------------------------- /CustomTransitionDemo/CustomTransitionDemo/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 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /CustomTransitionDemo/CustomTransitionDemo/TransitionAnimator.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TransitionAnimator.swift 3 | // CustomTransitionDemo 4 | // 5 | // Created by Artur Rymarz on 01.08.2018. 6 | // Copyright © 2018 OpenSource. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | final class TransitionAnimator: NSObject, UIViewControllerAnimatedTransitioning { 12 | // 1 13 | let presenting: Bool 14 | 15 | // 2 16 | init(presenting: Bool) { 17 | self.presenting = presenting 18 | } 19 | 20 | func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval { 21 | // 3 22 | return TimeInterval(UINavigationControllerHideShowBarDuration) 23 | } 24 | 25 | func animateTransition(using transitionContext: UIViewControllerContextTransitioning) { 26 | // 4 27 | guard let fromView = transitionContext.view(forKey: .from) else { return } 28 | guard let toView = transitionContext.view(forKey: .to) else { return } 29 | 30 | // 5 31 | let duration = transitionDuration(using: transitionContext) 32 | 33 | // 6 34 | let container = transitionContext.containerView 35 | if presenting { 36 | container.addSubview(toView) 37 | } else { 38 | container.insertSubview(toView, belowSubview: fromView) 39 | } 40 | 41 | // 7 42 | let toViewFrame = toView.frame 43 | toView.frame = CGRect(x: presenting ? toView.frame.width : -toView.frame.width, y: toView.frame.origin.y, width: toView.frame.width, height: toView.frame.height) 44 | 45 | let animations = { 46 | UIView.addKeyframe(withRelativeStartTime: 0.0, relativeDuration: 0.5) { 47 | toView.alpha = 1 48 | if self.presenting { 49 | fromView.alpha = 0 50 | } 51 | } 52 | 53 | UIView.addKeyframe(withRelativeStartTime: 0.0, relativeDuration: 1) { 54 | toView.frame = toViewFrame 55 | fromView.frame = CGRect(x: self.presenting ? -fromView.frame.width : fromView.frame.width, y: fromView.frame.origin.y, width: fromView.frame.width, height: fromView.frame.height) 56 | if !self.presenting { 57 | fromView.alpha = 0 58 | } 59 | } 60 | 61 | } 62 | 63 | UIView.animateKeyframes(withDuration: duration, 64 | delay: 0, 65 | options: .calculationModeCubic, 66 | animations: animations, 67 | completion: { finished in 68 | // 8 69 | container.addSubview(toView) 70 | transitionContext.completeTransition(!transitionContext.transitionWasCancelled) 71 | }) 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /CustomTransitionDemo/CustomTransitionDemo/TransitionCoordinator.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TransitionCoordinator.swift 3 | // CustomTransitionDemo 4 | // 5 | // Created by Artur Rymarz on 01.08.2018. 6 | // Copyright © 2018 OpenSource. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | import UIKit 12 | 13 | extension UINavigationController { 14 | // 1 15 | static private var coordinatorHelperKey = "UINavigationController.TransitionCoordinatorHelper" 16 | 17 | // 2 18 | var transitionCoordinatorHelper: TransitionCoordinator? { 19 | return objc_getAssociatedObject(self, &UINavigationController.coordinatorHelperKey) as? TransitionCoordinator 20 | } 21 | 22 | func addCustomTransitioning() { 23 | // 3 24 | var object = objc_getAssociatedObject(self, &UINavigationController.coordinatorHelperKey) 25 | 26 | guard object == nil else { 27 | return 28 | } 29 | 30 | object = TransitionCoordinator() 31 | let nonatomic = objc_AssociationPolicy.OBJC_ASSOCIATION_RETAIN_NONATOMIC 32 | objc_setAssociatedObject(self, &UINavigationController.coordinatorHelperKey, object, nonatomic) 33 | 34 | // 4 35 | delegate = object as? TransitionCoordinator 36 | 37 | 38 | // 5 39 | let edgeSwipeGestureRecognizer = UIScreenEdgePanGestureRecognizer(target: self, action: #selector(handleSwipe(_:))) 40 | edgeSwipeGestureRecognizer.edges = .left 41 | view.addGestureRecognizer(edgeSwipeGestureRecognizer) 42 | } 43 | 44 | // 6 45 | @objc func handleSwipe(_ gestureRecognizer: UIScreenEdgePanGestureRecognizer) { 46 | guard let gestureRecognizerView = gestureRecognizer.view else { 47 | transitionCoordinatorHelper?.interactionController = nil 48 | return 49 | } 50 | 51 | let percent = gestureRecognizer.translation(in: gestureRecognizerView).x / gestureRecognizerView.bounds.size.width 52 | 53 | if gestureRecognizer.state == .began { 54 | transitionCoordinatorHelper?.interactionController = UIPercentDrivenInteractiveTransition() 55 | popViewController(animated: true) 56 | } else if gestureRecognizer.state == .changed { 57 | transitionCoordinatorHelper?.interactionController?.update(percent) 58 | } else if gestureRecognizer.state == .ended { 59 | if percent > 0.5 && gestureRecognizer.state != .cancelled { 60 | transitionCoordinatorHelper?.interactionController?.finish() 61 | } else { 62 | transitionCoordinatorHelper?.interactionController?.cancel() 63 | } 64 | transitionCoordinatorHelper?.interactionController = nil 65 | } 66 | } 67 | } 68 | 69 | final class TransitionCoordinator: NSObject, UINavigationControllerDelegate { 70 | var interactionController: UIPercentDrivenInteractiveTransition? 71 | 72 | func navigationController(_ navigationController: UINavigationController, animationControllerFor operation: UINavigationControllerOperation, from fromVC: UIViewController, to toVC: UIViewController) -> UIViewControllerAnimatedTransitioning? { 73 | switch operation { 74 | case .push: 75 | return TransitionAnimator(presenting: true) 76 | case .pop: 77 | return TransitionAnimator(presenting: false) 78 | default: 79 | return nil 80 | } 81 | } 82 | 83 | func navigationController(_ navigationController: UINavigationController, interactionControllerFor animationController: UIViewControllerAnimatedTransitioning) -> UIViewControllerInteractiveTransitioning? { 84 | return interactionController 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /CustomTransitionDemo/CustomTransitionDemo/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // CustomTransitionDemo 4 | // 5 | // Created by Artur Rymarz on 01.08.2018. 6 | // Copyright © 2018 OpenSource. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController { 12 | 13 | override func viewDidLoad() { 14 | super.viewDidLoad() 15 | 16 | navigationController?.addCustomTransitioning() 17 | } 18 | } 19 | 20 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Artur Rymarz 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![Example](Resources/CustomTransition.gif?raw=true "glass-break") -------------------------------------------------------------------------------- /Resources/CustomTransition.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/artur-ios-dev/CustomTransition/1c0d588624d68e935d22c6acb1425403776e3c5f/Resources/CustomTransition.gif --------------------------------------------------------------------------------