├── InteractiveModal.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcuserdata │ └── robertchen.xcuserdatad │ └── xcschemes │ ├── InteractiveModal.xcscheme │ └── xcschememanagement.plist ├── InteractiveModal ├── AppDelegate.swift ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── DismissAnimator.swift ├── Info.plist ├── Interactor.swift ├── ModalViewController.swift └── ViewController.swift ├── LICENSE ├── README.md └── tableviewDismiss.gif /InteractiveModal.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | FC1737061C3DD1FC00AA7507 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC1737051C3DD1FC00AA7507 /* AppDelegate.swift */; }; 11 | FC1737081C3DD1FC00AA7507 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC1737071C3DD1FC00AA7507 /* ViewController.swift */; }; 12 | FC17370B1C3DD1FC00AA7507 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = FC1737091C3DD1FC00AA7507 /* Main.storyboard */; }; 13 | FC17370D1C3DD1FC00AA7507 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = FC17370C1C3DD1FC00AA7507 /* Assets.xcassets */; }; 14 | FC1737101C3DD1FC00AA7507 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = FC17370E1C3DD1FC00AA7507 /* LaunchScreen.storyboard */; }; 15 | FC1737181C3DD2BB00AA7507 /* ModalViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC1737171C3DD2BB00AA7507 /* ModalViewController.swift */; }; 16 | FC47B5C31C4D8C40007AB88A /* Interactor.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC47B5C21C4D8C40007AB88A /* Interactor.swift */; }; 17 | FCD232A31C4085B70016813F /* DismissAnimator.swift in Sources */ = {isa = PBXBuildFile; fileRef = FCD232A21C4085B70016813F /* DismissAnimator.swift */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXFileReference section */ 21 | FC1737021C3DD1FC00AA7507 /* InteractiveModal.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = InteractiveModal.app; sourceTree = BUILT_PRODUCTS_DIR; }; 22 | FC1737051C3DD1FC00AA7507 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 23 | FC1737071C3DD1FC00AA7507 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 24 | FC17370A1C3DD1FC00AA7507 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 25 | FC17370C1C3DD1FC00AA7507 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 26 | FC17370F1C3DD1FC00AA7507 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 27 | FC1737111C3DD1FC00AA7507 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 28 | FC1737171C3DD2BB00AA7507 /* ModalViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ModalViewController.swift; sourceTree = ""; }; 29 | FC47B5C21C4D8C40007AB88A /* Interactor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Interactor.swift; sourceTree = ""; }; 30 | FCD232A21C4085B70016813F /* DismissAnimator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DismissAnimator.swift; sourceTree = ""; }; 31 | /* End PBXFileReference section */ 32 | 33 | /* Begin PBXFrameworksBuildPhase section */ 34 | FC1736FF1C3DD1FC00AA7507 /* Frameworks */ = { 35 | isa = PBXFrameworksBuildPhase; 36 | buildActionMask = 2147483647; 37 | files = ( 38 | ); 39 | runOnlyForDeploymentPostprocessing = 0; 40 | }; 41 | /* End PBXFrameworksBuildPhase section */ 42 | 43 | /* Begin PBXGroup section */ 44 | FC1736F91C3DD1FC00AA7507 = { 45 | isa = PBXGroup; 46 | children = ( 47 | FC1737041C3DD1FC00AA7507 /* InteractiveModal */, 48 | FC1737031C3DD1FC00AA7507 /* Products */, 49 | ); 50 | sourceTree = ""; 51 | }; 52 | FC1737031C3DD1FC00AA7507 /* Products */ = { 53 | isa = PBXGroup; 54 | children = ( 55 | FC1737021C3DD1FC00AA7507 /* InteractiveModal.app */, 56 | ); 57 | name = Products; 58 | sourceTree = ""; 59 | }; 60 | FC1737041C3DD1FC00AA7507 /* InteractiveModal */ = { 61 | isa = PBXGroup; 62 | children = ( 63 | FC1737051C3DD1FC00AA7507 /* AppDelegate.swift */, 64 | FC1737071C3DD1FC00AA7507 /* ViewController.swift */, 65 | FC1737091C3DD1FC00AA7507 /* Main.storyboard */, 66 | FC1737171C3DD2BB00AA7507 /* ModalViewController.swift */, 67 | FCD232A21C4085B70016813F /* DismissAnimator.swift */, 68 | FC47B5C21C4D8C40007AB88A /* Interactor.swift */, 69 | FC17370C1C3DD1FC00AA7507 /* Assets.xcassets */, 70 | FC17370E1C3DD1FC00AA7507 /* LaunchScreen.storyboard */, 71 | FC1737111C3DD1FC00AA7507 /* Info.plist */, 72 | ); 73 | path = InteractiveModal; 74 | sourceTree = ""; 75 | }; 76 | /* End PBXGroup section */ 77 | 78 | /* Begin PBXNativeTarget section */ 79 | FC1737011C3DD1FC00AA7507 /* InteractiveModal */ = { 80 | isa = PBXNativeTarget; 81 | buildConfigurationList = FC1737141C3DD1FC00AA7507 /* Build configuration list for PBXNativeTarget "InteractiveModal" */; 82 | buildPhases = ( 83 | FC1736FE1C3DD1FC00AA7507 /* Sources */, 84 | FC1736FF1C3DD1FC00AA7507 /* Frameworks */, 85 | FC1737001C3DD1FC00AA7507 /* Resources */, 86 | ); 87 | buildRules = ( 88 | ); 89 | dependencies = ( 90 | ); 91 | name = InteractiveModal; 92 | productName = InteractiveModal; 93 | productReference = FC1737021C3DD1FC00AA7507 /* InteractiveModal.app */; 94 | productType = "com.apple.product-type.application"; 95 | }; 96 | /* End PBXNativeTarget section */ 97 | 98 | /* Begin PBXProject section */ 99 | FC1736FA1C3DD1FC00AA7507 /* Project object */ = { 100 | isa = PBXProject; 101 | attributes = { 102 | LastSwiftUpdateCheck = 0720; 103 | LastUpgradeCheck = 0920; 104 | ORGANIZATIONNAME = "Thorn Technologies"; 105 | TargetAttributes = { 106 | FC1737011C3DD1FC00AA7507 = { 107 | CreatedOnToolsVersion = 7.2; 108 | }; 109 | }; 110 | }; 111 | buildConfigurationList = FC1736FD1C3DD1FC00AA7507 /* Build configuration list for PBXProject "InteractiveModal" */; 112 | compatibilityVersion = "Xcode 3.2"; 113 | developmentRegion = English; 114 | hasScannedForEncodings = 0; 115 | knownRegions = ( 116 | en, 117 | Base, 118 | ); 119 | mainGroup = FC1736F91C3DD1FC00AA7507; 120 | productRefGroup = FC1737031C3DD1FC00AA7507 /* Products */; 121 | projectDirPath = ""; 122 | projectRoot = ""; 123 | targets = ( 124 | FC1737011C3DD1FC00AA7507 /* InteractiveModal */, 125 | ); 126 | }; 127 | /* End PBXProject section */ 128 | 129 | /* Begin PBXResourcesBuildPhase section */ 130 | FC1737001C3DD1FC00AA7507 /* Resources */ = { 131 | isa = PBXResourcesBuildPhase; 132 | buildActionMask = 2147483647; 133 | files = ( 134 | FC1737101C3DD1FC00AA7507 /* LaunchScreen.storyboard in Resources */, 135 | FC17370D1C3DD1FC00AA7507 /* Assets.xcassets in Resources */, 136 | FC17370B1C3DD1FC00AA7507 /* Main.storyboard in Resources */, 137 | ); 138 | runOnlyForDeploymentPostprocessing = 0; 139 | }; 140 | /* End PBXResourcesBuildPhase section */ 141 | 142 | /* Begin PBXSourcesBuildPhase section */ 143 | FC1736FE1C3DD1FC00AA7507 /* Sources */ = { 144 | isa = PBXSourcesBuildPhase; 145 | buildActionMask = 2147483647; 146 | files = ( 147 | FC1737081C3DD1FC00AA7507 /* ViewController.swift in Sources */, 148 | FC1737181C3DD2BB00AA7507 /* ModalViewController.swift in Sources */, 149 | FC47B5C31C4D8C40007AB88A /* Interactor.swift in Sources */, 150 | FC1737061C3DD1FC00AA7507 /* AppDelegate.swift in Sources */, 151 | FCD232A31C4085B70016813F /* DismissAnimator.swift in Sources */, 152 | ); 153 | runOnlyForDeploymentPostprocessing = 0; 154 | }; 155 | /* End PBXSourcesBuildPhase section */ 156 | 157 | /* Begin PBXVariantGroup section */ 158 | FC1737091C3DD1FC00AA7507 /* Main.storyboard */ = { 159 | isa = PBXVariantGroup; 160 | children = ( 161 | FC17370A1C3DD1FC00AA7507 /* Base */, 162 | ); 163 | name = Main.storyboard; 164 | sourceTree = ""; 165 | }; 166 | FC17370E1C3DD1FC00AA7507 /* LaunchScreen.storyboard */ = { 167 | isa = PBXVariantGroup; 168 | children = ( 169 | FC17370F1C3DD1FC00AA7507 /* Base */, 170 | ); 171 | name = LaunchScreen.storyboard; 172 | sourceTree = ""; 173 | }; 174 | /* End PBXVariantGroup section */ 175 | 176 | /* Begin XCBuildConfiguration section */ 177 | FC1737121C3DD1FC00AA7507 /* Debug */ = { 178 | isa = XCBuildConfiguration; 179 | buildSettings = { 180 | ALWAYS_SEARCH_USER_PATHS = NO; 181 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 182 | CLANG_CXX_LIBRARY = "libc++"; 183 | CLANG_ENABLE_MODULES = YES; 184 | CLANG_ENABLE_OBJC_ARC = YES; 185 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 186 | CLANG_WARN_BOOL_CONVERSION = YES; 187 | CLANG_WARN_COMMA = YES; 188 | CLANG_WARN_CONSTANT_CONVERSION = YES; 189 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 190 | CLANG_WARN_EMPTY_BODY = YES; 191 | CLANG_WARN_ENUM_CONVERSION = YES; 192 | CLANG_WARN_INFINITE_RECURSION = YES; 193 | CLANG_WARN_INT_CONVERSION = YES; 194 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 195 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 196 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 197 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 198 | CLANG_WARN_STRICT_PROTOTYPES = YES; 199 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 200 | CLANG_WARN_UNREACHABLE_CODE = YES; 201 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 202 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 203 | COPY_PHASE_STRIP = NO; 204 | DEBUG_INFORMATION_FORMAT = dwarf; 205 | ENABLE_STRICT_OBJC_MSGSEND = YES; 206 | ENABLE_TESTABILITY = YES; 207 | GCC_C_LANGUAGE_STANDARD = gnu99; 208 | GCC_DYNAMIC_NO_PIC = NO; 209 | GCC_NO_COMMON_BLOCKS = YES; 210 | GCC_OPTIMIZATION_LEVEL = 0; 211 | GCC_PREPROCESSOR_DEFINITIONS = ( 212 | "DEBUG=1", 213 | "$(inherited)", 214 | ); 215 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 216 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 217 | GCC_WARN_UNDECLARED_SELECTOR = YES; 218 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 219 | GCC_WARN_UNUSED_FUNCTION = YES; 220 | GCC_WARN_UNUSED_VARIABLE = YES; 221 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 222 | MTL_ENABLE_DEBUG_INFO = YES; 223 | ONLY_ACTIVE_ARCH = YES; 224 | SDKROOT = iphoneos; 225 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 226 | SWIFT_VERSION = 4.0; 227 | TARGETED_DEVICE_FAMILY = "1,2"; 228 | }; 229 | name = Debug; 230 | }; 231 | FC1737131C3DD1FC00AA7507 /* Release */ = { 232 | isa = XCBuildConfiguration; 233 | buildSettings = { 234 | ALWAYS_SEARCH_USER_PATHS = NO; 235 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 236 | CLANG_CXX_LIBRARY = "libc++"; 237 | CLANG_ENABLE_MODULES = YES; 238 | CLANG_ENABLE_OBJC_ARC = YES; 239 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 240 | CLANG_WARN_BOOL_CONVERSION = YES; 241 | CLANG_WARN_COMMA = YES; 242 | CLANG_WARN_CONSTANT_CONVERSION = YES; 243 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 244 | CLANG_WARN_EMPTY_BODY = YES; 245 | CLANG_WARN_ENUM_CONVERSION = YES; 246 | CLANG_WARN_INFINITE_RECURSION = YES; 247 | CLANG_WARN_INT_CONVERSION = YES; 248 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 249 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 250 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 251 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 252 | CLANG_WARN_STRICT_PROTOTYPES = YES; 253 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 254 | CLANG_WARN_UNREACHABLE_CODE = YES; 255 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 256 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 257 | COPY_PHASE_STRIP = NO; 258 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 259 | ENABLE_NS_ASSERTIONS = NO; 260 | ENABLE_STRICT_OBJC_MSGSEND = YES; 261 | GCC_C_LANGUAGE_STANDARD = gnu99; 262 | GCC_NO_COMMON_BLOCKS = YES; 263 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 264 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 265 | GCC_WARN_UNDECLARED_SELECTOR = YES; 266 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 267 | GCC_WARN_UNUSED_FUNCTION = YES; 268 | GCC_WARN_UNUSED_VARIABLE = YES; 269 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 270 | MTL_ENABLE_DEBUG_INFO = NO; 271 | SDKROOT = iphoneos; 272 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 273 | SWIFT_VERSION = 4.0; 274 | TARGETED_DEVICE_FAMILY = "1,2"; 275 | VALIDATE_PRODUCT = YES; 276 | }; 277 | name = Release; 278 | }; 279 | FC1737151C3DD1FC00AA7507 /* Debug */ = { 280 | isa = XCBuildConfiguration; 281 | buildSettings = { 282 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 283 | INFOPLIST_FILE = InteractiveModal/Info.plist; 284 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 285 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 286 | PRODUCT_BUNDLE_IDENTIFIER = com.thorntech.InteractiveModal; 287 | PRODUCT_NAME = "$(TARGET_NAME)"; 288 | }; 289 | name = Debug; 290 | }; 291 | FC1737161C3DD1FC00AA7507 /* Release */ = { 292 | isa = XCBuildConfiguration; 293 | buildSettings = { 294 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 295 | INFOPLIST_FILE = InteractiveModal/Info.plist; 296 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 297 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 298 | PRODUCT_BUNDLE_IDENTIFIER = com.thorntech.InteractiveModal; 299 | PRODUCT_NAME = "$(TARGET_NAME)"; 300 | }; 301 | name = Release; 302 | }; 303 | /* End XCBuildConfiguration section */ 304 | 305 | /* Begin XCConfigurationList section */ 306 | FC1736FD1C3DD1FC00AA7507 /* Build configuration list for PBXProject "InteractiveModal" */ = { 307 | isa = XCConfigurationList; 308 | buildConfigurations = ( 309 | FC1737121C3DD1FC00AA7507 /* Debug */, 310 | FC1737131C3DD1FC00AA7507 /* Release */, 311 | ); 312 | defaultConfigurationIsVisible = 0; 313 | defaultConfigurationName = Release; 314 | }; 315 | FC1737141C3DD1FC00AA7507 /* Build configuration list for PBXNativeTarget "InteractiveModal" */ = { 316 | isa = XCConfigurationList; 317 | buildConfigurations = ( 318 | FC1737151C3DD1FC00AA7507 /* Debug */, 319 | FC1737161C3DD1FC00AA7507 /* Release */, 320 | ); 321 | defaultConfigurationIsVisible = 0; 322 | defaultConfigurationName = Release; 323 | }; 324 | /* End XCConfigurationList section */ 325 | }; 326 | rootObject = FC1736FA1C3DD1FC00AA7507 /* Project object */; 327 | } 328 | -------------------------------------------------------------------------------- /InteractiveModal.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /InteractiveModal.xcodeproj/xcuserdata/robertchen.xcuserdatad/xcschemes/InteractiveModal.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /InteractiveModal.xcodeproj/xcuserdata/robertchen.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | InteractiveModal.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | FC1737011C3DD1FC00AA7507 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /InteractiveModal/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // InteractiveModal 4 | // 5 | // Created by Robert Chen on 1/6/16. 6 | // Copyright © 2016 Thorn Technologies. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | var window: UIWindow? 14 | } 15 | 16 | -------------------------------------------------------------------------------- /InteractiveModal/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /InteractiveModal/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 | 27 | 28 | -------------------------------------------------------------------------------- /InteractiveModal/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 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /InteractiveModal/DismissAnimator.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DismissAnimator.swift 3 | // InteractiveModal 4 | // 5 | // Created by Robert Chen on 1/8/16. 6 | // Copyright © 2016 Thorn Technologies. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class DismissAnimator : NSObject { 12 | } 13 | 14 | extension DismissAnimator : UIViewControllerAnimatedTransitioning { 15 | func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval { 16 | return 0.6 17 | } 18 | 19 | func animateTransition(using transitionContext: UIViewControllerContextTransitioning) { 20 | guard 21 | let fromVC = transitionContext.viewController(forKey: UITransitionContextViewControllerKey.from), 22 | let toVC = transitionContext.viewController(forKey: UITransitionContextViewControllerKey.to) 23 | else { 24 | return 25 | } 26 | 27 | transitionContext.containerView.insertSubview(toVC.view, belowSubview: fromVC.view) 28 | 29 | let screenBounds = UIScreen.main.bounds 30 | let bottomLeftCorner = CGPoint(x: 0, y: screenBounds.height) 31 | let finalFrame = CGRect(origin: bottomLeftCorner, size: screenBounds.size) 32 | 33 | UIView.animate( 34 | withDuration: transitionDuration(using: transitionContext), 35 | animations: { 36 | fromVC.view.frame = finalFrame 37 | }, 38 | completion: { _ in 39 | transitionContext.completeTransition(!transitionContext.transitionWasCancelled) 40 | } 41 | ) 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /InteractiveModal/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 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 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /InteractiveModal/Interactor.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Interactor.swift 3 | // InteractiveModal 4 | // 5 | // Created by Robert Chen on 1/18/16. 6 | // Copyright © 2016 Thorn Technologies. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class Interactor: UIPercentDrivenInteractiveTransition { 12 | var hasStarted = false 13 | var shouldFinish = false 14 | } -------------------------------------------------------------------------------- /InteractiveModal/ModalViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ModalViewController.swift 3 | // InteractiveModal 4 | // 5 | // Created by Robert Chen on 1/6/16. 6 | // Copyright © 2016 Thorn Technologies. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ModalViewController: UIViewController { 12 | 13 | var interactor:Interactor? = nil 14 | 15 | @IBAction func close(_ sender: UIButton) { 16 | dismiss(animated: true, completion: nil) 17 | } 18 | 19 | @IBAction func handleGesture(_ sender: UIPanGestureRecognizer) { 20 | 21 | let percentThreshold:CGFloat = 0.3 22 | 23 | // convert y-position to downward pull progress (percentage) 24 | let translation = sender.translation(in: view) 25 | let verticalMovement = translation.y / view.bounds.height 26 | let downwardMovement = fmaxf(Float(verticalMovement), 0.0) 27 | let downwardMovementPercent = fminf(downwardMovement, 1.0) 28 | let progress = CGFloat(downwardMovementPercent) 29 | 30 | guard let interactor = interactor else { return } 31 | 32 | switch sender.state { 33 | case .began: 34 | interactor.hasStarted = true 35 | dismiss(animated: true, completion: nil) 36 | case .changed: 37 | interactor.shouldFinish = progress > percentThreshold 38 | interactor.update(progress) 39 | case .cancelled: 40 | interactor.hasStarted = false 41 | interactor.cancel() 42 | case .ended: 43 | interactor.hasStarted = false 44 | interactor.shouldFinish 45 | ? interactor.finish() 46 | : interactor.cancel() 47 | default: 48 | break 49 | } 50 | } 51 | 52 | func showHelperCircle(){ 53 | let center = CGPoint(x: view.bounds.width * 0.5, y: 100) 54 | let small = CGSize(width: 30, height: 30) 55 | let circle = UIView(frame: CGRect(origin: center, size: small)) 56 | circle.layer.cornerRadius = circle.frame.width/2 57 | circle.backgroundColor = UIColor.white 58 | circle.layer.shadowOpacity = 0.8 59 | circle.layer.shadowOffset = CGSize() 60 | view.addSubview(circle) 61 | UIView.animate( 62 | withDuration: 0.5, 63 | delay: 0.25, 64 | options: [], 65 | animations: { 66 | circle.frame.origin.y += 200 67 | circle.layer.opacity = 0 68 | }, 69 | completion: { _ in 70 | circle.removeFromSuperview() 71 | } 72 | ) 73 | } 74 | 75 | override func viewDidAppear(_ animated: Bool) { 76 | showHelperCircle() 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /InteractiveModal/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // InteractiveModal 4 | // 5 | // Created by Robert Chen on 1/6/16. 6 | // Copyright © 2016 Thorn Technologies. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController { 12 | 13 | let interactor = Interactor() 14 | 15 | override func prepare(for segue: UIStoryboardSegue, sender: Any?) { 16 | if let destinationViewController = segue.destination as? ModalViewController { 17 | destinationViewController.transitioningDelegate = self 18 | destinationViewController.interactor = interactor 19 | } 20 | } 21 | } 22 | 23 | extension ViewController: UIViewControllerTransitioningDelegate { 24 | func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? { 25 | return DismissAnimator() 26 | } 27 | 28 | func interactionControllerForDismissal(using animator: UIViewControllerAnimatedTransitioning) -> UIViewControllerInteractiveTransitioning? { 29 | return interactor.hasStarted ? interactor : nil 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Thorn Technologies LLC 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 | 2 | -------------------------------------------------------------------------------- /tableviewDismiss.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThornTechPublic/InteractiveModal/cbd30aac7d930b49c5b20eb6e961edbdfe05a524/tableviewDismiss.gif --------------------------------------------------------------------------------