├── .gitignore ├── HackingSFViewController.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcuserdata │ └── stringCode.xcuserdatad │ └── xcschemes │ ├── HackingSFViewController.xcscheme │ └── xcschememanagement.plist ├── HackingSFViewController ├── AppDelegate.swift ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ ├── Contents.json │ └── shadow.imageset │ │ ├── Contents.json │ │ └── shadow@2x.png ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist ├── SCModalPushPopAnimator.swift ├── SCSafariViewController.swift └── ViewController.swift ├── LICENSE.md ├── README.md └── SCSafariViewController.gif /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | 3 | temp 4 | master/ 5 | live/ 6 | 7 | *.pbxuser 8 | *.perspective 9 | *.perspectivev3 10 | 11 | *.mode1v3 12 | *.mode2v3 13 | 14 | **/xcuserdata/** 15 | *.xcuserstate 16 | 17 | docset-installed.txt -------------------------------------------------------------------------------- /HackingSFViewController.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 9FFF46C21BC922ED001451EE /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FFF46C11BC922ED001451EE /* AppDelegate.swift */; }; 11 | 9FFF46C41BC922ED001451EE /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FFF46C31BC922ED001451EE /* ViewController.swift */; }; 12 | 9FFF46C71BC922ED001451EE /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9FFF46C51BC922ED001451EE /* Main.storyboard */; }; 13 | 9FFF46C91BC922ED001451EE /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9FFF46C81BC922ED001451EE /* Assets.xcassets */; }; 14 | 9FFF46CC1BC922ED001451EE /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9FFF46CA1BC922ED001451EE /* LaunchScreen.storyboard */; }; 15 | 9FFF46D41BC938A9001451EE /* SCSafariViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FFF46D31BC938A9001451EE /* SCSafariViewController.swift */; settings = {ASSET_TAGS = (); }; }; 16 | 9FFF46D71BC956A6001451EE /* SCModalPushPopAnimator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FFF46D61BC956A6001451EE /* SCModalPushPopAnimator.swift */; settings = {ASSET_TAGS = (); }; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXFileReference section */ 20 | 9FFF46BE1BC922ED001451EE /* HackingSFViewController.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HackingSFViewController.app; sourceTree = BUILT_PRODUCTS_DIR; }; 21 | 9FFF46C11BC922ED001451EE /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 22 | 9FFF46C31BC922ED001451EE /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 23 | 9FFF46C61BC922ED001451EE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 24 | 9FFF46C81BC922ED001451EE /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 25 | 9FFF46CB1BC922ED001451EE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 26 | 9FFF46CD1BC922ED001451EE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 27 | 9FFF46D31BC938A9001451EE /* SCSafariViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SCSafariViewController.swift; sourceTree = ""; }; 28 | 9FFF46D61BC956A6001451EE /* SCModalPushPopAnimator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SCModalPushPopAnimator.swift; sourceTree = ""; }; 29 | /* End PBXFileReference section */ 30 | 31 | /* Begin PBXFrameworksBuildPhase section */ 32 | 9FFF46BB1BC922ED001451EE /* Frameworks */ = { 33 | isa = PBXFrameworksBuildPhase; 34 | buildActionMask = 2147483647; 35 | files = ( 36 | ); 37 | runOnlyForDeploymentPostprocessing = 0; 38 | }; 39 | /* End PBXFrameworksBuildPhase section */ 40 | 41 | /* Begin PBXGroup section */ 42 | 9FFF46B51BC922ED001451EE = { 43 | isa = PBXGroup; 44 | children = ( 45 | 9FFF46C01BC922ED001451EE /* HackingSFViewController */, 46 | 9FFF46BF1BC922ED001451EE /* Products */, 47 | ); 48 | sourceTree = ""; 49 | }; 50 | 9FFF46BF1BC922ED001451EE /* Products */ = { 51 | isa = PBXGroup; 52 | children = ( 53 | 9FFF46BE1BC922ED001451EE /* HackingSFViewController.app */, 54 | ); 55 | name = Products; 56 | sourceTree = ""; 57 | }; 58 | 9FFF46C01BC922ED001451EE /* HackingSFViewController */ = { 59 | isa = PBXGroup; 60 | children = ( 61 | 9FFF46C11BC922ED001451EE /* AppDelegate.swift */, 62 | 9FFF46C31BC922ED001451EE /* ViewController.swift */, 63 | 9FFF46D61BC956A6001451EE /* SCModalPushPopAnimator.swift */, 64 | 9FFF46D31BC938A9001451EE /* SCSafariViewController.swift */, 65 | 9FFF46C51BC922ED001451EE /* Main.storyboard */, 66 | 9FFF46C81BC922ED001451EE /* Assets.xcassets */, 67 | 9FFF46CA1BC922ED001451EE /* LaunchScreen.storyboard */, 68 | 9FFF46CD1BC922ED001451EE /* Info.plist */, 69 | ); 70 | path = HackingSFViewController; 71 | sourceTree = ""; 72 | }; 73 | /* End PBXGroup section */ 74 | 75 | /* Begin PBXNativeTarget section */ 76 | 9FFF46BD1BC922ED001451EE /* HackingSFViewController */ = { 77 | isa = PBXNativeTarget; 78 | buildConfigurationList = 9FFF46D01BC922ED001451EE /* Build configuration list for PBXNativeTarget "HackingSFViewController" */; 79 | buildPhases = ( 80 | 9FFF46BA1BC922ED001451EE /* Sources */, 81 | 9FFF46BB1BC922ED001451EE /* Frameworks */, 82 | 9FFF46BC1BC922ED001451EE /* Resources */, 83 | ); 84 | buildRules = ( 85 | ); 86 | dependencies = ( 87 | ); 88 | name = HackingSFViewController; 89 | productName = HackingSFViewController; 90 | productReference = 9FFF46BE1BC922ED001451EE /* HackingSFViewController.app */; 91 | productType = "com.apple.product-type.application"; 92 | }; 93 | /* End PBXNativeTarget section */ 94 | 95 | /* Begin PBXProject section */ 96 | 9FFF46B61BC922ED001451EE /* Project object */ = { 97 | isa = PBXProject; 98 | attributes = { 99 | LastUpgradeCheck = 0700; 100 | ORGANIZATIONNAME = stringCode; 101 | TargetAttributes = { 102 | 9FFF46BD1BC922ED001451EE = { 103 | CreatedOnToolsVersion = 7.0.1; 104 | }; 105 | }; 106 | }; 107 | buildConfigurationList = 9FFF46B91BC922ED001451EE /* Build configuration list for PBXProject "HackingSFViewController" */; 108 | compatibilityVersion = "Xcode 3.2"; 109 | developmentRegion = English; 110 | hasScannedForEncodings = 0; 111 | knownRegions = ( 112 | en, 113 | Base, 114 | ); 115 | mainGroup = 9FFF46B51BC922ED001451EE; 116 | productRefGroup = 9FFF46BF1BC922ED001451EE /* Products */; 117 | projectDirPath = ""; 118 | projectRoot = ""; 119 | targets = ( 120 | 9FFF46BD1BC922ED001451EE /* HackingSFViewController */, 121 | ); 122 | }; 123 | /* End PBXProject section */ 124 | 125 | /* Begin PBXResourcesBuildPhase section */ 126 | 9FFF46BC1BC922ED001451EE /* Resources */ = { 127 | isa = PBXResourcesBuildPhase; 128 | buildActionMask = 2147483647; 129 | files = ( 130 | 9FFF46CC1BC922ED001451EE /* LaunchScreen.storyboard in Resources */, 131 | 9FFF46C91BC922ED001451EE /* Assets.xcassets in Resources */, 132 | 9FFF46C71BC922ED001451EE /* Main.storyboard in Resources */, 133 | ); 134 | runOnlyForDeploymentPostprocessing = 0; 135 | }; 136 | /* End PBXResourcesBuildPhase section */ 137 | 138 | /* Begin PBXSourcesBuildPhase section */ 139 | 9FFF46BA1BC922ED001451EE /* Sources */ = { 140 | isa = PBXSourcesBuildPhase; 141 | buildActionMask = 2147483647; 142 | files = ( 143 | 9FFF46C41BC922ED001451EE /* ViewController.swift in Sources */, 144 | 9FFF46D41BC938A9001451EE /* SCSafariViewController.swift in Sources */, 145 | 9FFF46D71BC956A6001451EE /* SCModalPushPopAnimator.swift in Sources */, 146 | 9FFF46C21BC922ED001451EE /* AppDelegate.swift in Sources */, 147 | ); 148 | runOnlyForDeploymentPostprocessing = 0; 149 | }; 150 | /* End PBXSourcesBuildPhase section */ 151 | 152 | /* Begin PBXVariantGroup section */ 153 | 9FFF46C51BC922ED001451EE /* Main.storyboard */ = { 154 | isa = PBXVariantGroup; 155 | children = ( 156 | 9FFF46C61BC922ED001451EE /* Base */, 157 | ); 158 | name = Main.storyboard; 159 | sourceTree = ""; 160 | }; 161 | 9FFF46CA1BC922ED001451EE /* LaunchScreen.storyboard */ = { 162 | isa = PBXVariantGroup; 163 | children = ( 164 | 9FFF46CB1BC922ED001451EE /* Base */, 165 | ); 166 | name = LaunchScreen.storyboard; 167 | sourceTree = ""; 168 | }; 169 | /* End PBXVariantGroup section */ 170 | 171 | /* Begin XCBuildConfiguration section */ 172 | 9FFF46CE1BC922ED001451EE /* Debug */ = { 173 | isa = XCBuildConfiguration; 174 | buildSettings = { 175 | ALWAYS_SEARCH_USER_PATHS = NO; 176 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 177 | CLANG_CXX_LIBRARY = "libc++"; 178 | CLANG_ENABLE_MODULES = YES; 179 | CLANG_ENABLE_OBJC_ARC = YES; 180 | CLANG_WARN_BOOL_CONVERSION = YES; 181 | CLANG_WARN_CONSTANT_CONVERSION = YES; 182 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 183 | CLANG_WARN_EMPTY_BODY = YES; 184 | CLANG_WARN_ENUM_CONVERSION = YES; 185 | CLANG_WARN_INT_CONVERSION = YES; 186 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 187 | CLANG_WARN_UNREACHABLE_CODE = YES; 188 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 189 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 190 | COPY_PHASE_STRIP = NO; 191 | DEBUG_INFORMATION_FORMAT = dwarf; 192 | ENABLE_STRICT_OBJC_MSGSEND = YES; 193 | ENABLE_TESTABILITY = YES; 194 | GCC_C_LANGUAGE_STANDARD = gnu99; 195 | GCC_DYNAMIC_NO_PIC = NO; 196 | GCC_NO_COMMON_BLOCKS = YES; 197 | GCC_OPTIMIZATION_LEVEL = 0; 198 | GCC_PREPROCESSOR_DEFINITIONS = ( 199 | "DEBUG=1", 200 | "$(inherited)", 201 | ); 202 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 203 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 204 | GCC_WARN_UNDECLARED_SELECTOR = YES; 205 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 206 | GCC_WARN_UNUSED_FUNCTION = YES; 207 | GCC_WARN_UNUSED_VARIABLE = YES; 208 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 209 | MTL_ENABLE_DEBUG_INFO = YES; 210 | ONLY_ACTIVE_ARCH = YES; 211 | SDKROOT = iphoneos; 212 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 213 | TARGETED_DEVICE_FAMILY = "1,2"; 214 | }; 215 | name = Debug; 216 | }; 217 | 9FFF46CF1BC922ED001451EE /* Release */ = { 218 | isa = XCBuildConfiguration; 219 | buildSettings = { 220 | ALWAYS_SEARCH_USER_PATHS = NO; 221 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 222 | CLANG_CXX_LIBRARY = "libc++"; 223 | CLANG_ENABLE_MODULES = YES; 224 | CLANG_ENABLE_OBJC_ARC = YES; 225 | CLANG_WARN_BOOL_CONVERSION = YES; 226 | CLANG_WARN_CONSTANT_CONVERSION = YES; 227 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 228 | CLANG_WARN_EMPTY_BODY = YES; 229 | CLANG_WARN_ENUM_CONVERSION = YES; 230 | CLANG_WARN_INT_CONVERSION = YES; 231 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 232 | CLANG_WARN_UNREACHABLE_CODE = YES; 233 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 234 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 235 | COPY_PHASE_STRIP = NO; 236 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 237 | ENABLE_NS_ASSERTIONS = NO; 238 | ENABLE_STRICT_OBJC_MSGSEND = YES; 239 | GCC_C_LANGUAGE_STANDARD = gnu99; 240 | GCC_NO_COMMON_BLOCKS = YES; 241 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 242 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 243 | GCC_WARN_UNDECLARED_SELECTOR = YES; 244 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 245 | GCC_WARN_UNUSED_FUNCTION = YES; 246 | GCC_WARN_UNUSED_VARIABLE = YES; 247 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 248 | MTL_ENABLE_DEBUG_INFO = NO; 249 | SDKROOT = iphoneos; 250 | TARGETED_DEVICE_FAMILY = "1,2"; 251 | VALIDATE_PRODUCT = YES; 252 | }; 253 | name = Release; 254 | }; 255 | 9FFF46D11BC922ED001451EE /* Debug */ = { 256 | isa = XCBuildConfiguration; 257 | buildSettings = { 258 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 259 | INFOPLIST_FILE = HackingSFViewController/Info.plist; 260 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 261 | PRODUCT_BUNDLE_IDENTIFIER = co.uk.stringcode.HackingSFViewController; 262 | PRODUCT_NAME = "$(TARGET_NAME)"; 263 | }; 264 | name = Debug; 265 | }; 266 | 9FFF46D21BC922ED001451EE /* Release */ = { 267 | isa = XCBuildConfiguration; 268 | buildSettings = { 269 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 270 | INFOPLIST_FILE = HackingSFViewController/Info.plist; 271 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 272 | PRODUCT_BUNDLE_IDENTIFIER = co.uk.stringcode.HackingSFViewController; 273 | PRODUCT_NAME = "$(TARGET_NAME)"; 274 | }; 275 | name = Release; 276 | }; 277 | /* End XCBuildConfiguration section */ 278 | 279 | /* Begin XCConfigurationList section */ 280 | 9FFF46B91BC922ED001451EE /* Build configuration list for PBXProject "HackingSFViewController" */ = { 281 | isa = XCConfigurationList; 282 | buildConfigurations = ( 283 | 9FFF46CE1BC922ED001451EE /* Debug */, 284 | 9FFF46CF1BC922ED001451EE /* Release */, 285 | ); 286 | defaultConfigurationIsVisible = 0; 287 | defaultConfigurationName = Release; 288 | }; 289 | 9FFF46D01BC922ED001451EE /* Build configuration list for PBXNativeTarget "HackingSFViewController" */ = { 290 | isa = XCConfigurationList; 291 | buildConfigurations = ( 292 | 9FFF46D11BC922ED001451EE /* Debug */, 293 | 9FFF46D21BC922ED001451EE /* Release */, 294 | ); 295 | defaultConfigurationIsVisible = 0; 296 | }; 297 | /* End XCConfigurationList section */ 298 | }; 299 | rootObject = 9FFF46B61BC922ED001451EE /* Project object */; 300 | } 301 | -------------------------------------------------------------------------------- /HackingSFViewController.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /HackingSFViewController.xcodeproj/xcuserdata/stringCode.xcuserdatad/xcschemes/HackingSFViewController.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 | -------------------------------------------------------------------------------- /HackingSFViewController.xcodeproj/xcuserdata/stringCode.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | HackingSFViewController.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 9FFF46BD1BC922ED001451EE 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /HackingSFViewController/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // HackingSFViewController 4 | // 5 | // Created by stringCode on 10/10/2015. 6 | // Copyright © 2015 stringCode. 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: [NSObject: AnyObject]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(application: UIApplication) { 23 | // 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. 24 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(application: UIApplication) { 28 | // 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. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(application: UIApplication) { 33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(application: UIApplication) { 37 | // 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. 38 | } 39 | 40 | func applicationWillTerminate(application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /HackingSFViewController/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 | } -------------------------------------------------------------------------------- /HackingSFViewController/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /HackingSFViewController/Assets.xcassets/shadow.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "shadow@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /HackingSFViewController/Assets.xcassets/shadow.imageset/shadow@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stringcode86/SCSafariViewController/74dc931882cf7f0b5565cf3dec1bca7db03bedc8/HackingSFViewController/Assets.xcassets/shadow.imageset/shadow@2x.png -------------------------------------------------------------------------------- /HackingSFViewController/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 | -------------------------------------------------------------------------------- /HackingSFViewController/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 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /HackingSFViewController/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 | -------------------------------------------------------------------------------- /HackingSFViewController/SCModalPushPopAnimator.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SCAnimator.swift 3 | // SCUtils 4 | // 5 | // Created by stringCode on 3/1/15. 6 | // Copyright (c) 2015 stringCode. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class SCModalPushPopAnimator: UIPercentDrivenInteractiveTransition, UIViewControllerAnimatedTransitioning { 12 | 13 | var dismissing = false 14 | var percentageDriven: Bool = false 15 | 16 | func transitionDuration(transitionContext: UIViewControllerContextTransitioning?) -> NSTimeInterval { 17 | return 0.75 18 | } 19 | 20 | func animateTransition(transitionContext: UIViewControllerContextTransitioning) { 21 | let fromViewController = transitionContext.viewControllerForKey(UITransitionContextFromViewControllerKey)! 22 | let toViewController = transitionContext.viewControllerForKey(UITransitionContextToViewControllerKey)! 23 | 24 | let topView = dismissing ? fromViewController.view : toViewController.view 25 | let bottomViewController = dismissing ? toViewController : fromViewController 26 | var bottomView = bottomViewController.view 27 | let offset = bottomView.bounds.size.width 28 | if let navVC = bottomViewController as? UINavigationController { 29 | bottomView = navVC.topViewController?.view 30 | } 31 | 32 | transitionContext.containerView()?.insertSubview(toViewController.view, aboveSubview: fromViewController.view) 33 | if dismissing { transitionContext.containerView()?.insertSubview(toViewController.view, belowSubview: fromViewController.view) } 34 | 35 | topView.frame = fromViewController.view.frame 36 | topView.transform = dismissing ? CGAffineTransformIdentity : CGAffineTransformMakeTranslation(offset, 0) 37 | 38 | let shadowView = UIImageView(image: UIImage(named: "shadow")) 39 | shadowView.contentMode = UIViewContentMode.ScaleAspectFill 40 | shadowView.layer.anchorPoint = CGPoint(x: 0, y: 0.5) 41 | shadowView.frame = bottomView.bounds 42 | bottomView.addSubview(shadowView) 43 | shadowView.transform = dismissing ? CGAffineTransformMakeScale(0.01, 1) : CGAffineTransformIdentity 44 | shadowView.alpha = self.dismissing ? 1.0 : 0.0 45 | 46 | UIView.animateWithDuration(transitionDuration(transitionContext), delay: 0, usingSpringWithDamping: 0.9, initialSpringVelocity: 1.0, options: SCModalPushPopAnimator.animOpts(), animations: { () -> Void in 47 | topView.transform = self.dismissing ? CGAffineTransformMakeTranslation(offset, 0) : CGAffineTransformIdentity 48 | shadowView.transform = self.dismissing ? CGAffineTransformIdentity : CGAffineTransformMakeScale(0.01, 1) 49 | shadowView.alpha = self.dismissing ? 0.0 : 1.0 50 | }) { ( finished ) -> Void in 51 | topView.transform = CGAffineTransformIdentity 52 | shadowView.removeFromSuperview() 53 | transitionContext.completeTransition(!transitionContext.transitionWasCancelled()) 54 | } 55 | } 56 | 57 | class func animOpts() -> UIViewAnimationOptions { 58 | return UIViewAnimationOptions.AllowAnimatedContent.union(UIViewAnimationOptions.BeginFromCurrentState).union(UIViewAnimationOptions.LayoutSubviews) 59 | } 60 | } -------------------------------------------------------------------------------- /HackingSFViewController/SCSafariViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SCSafariViewController.swift 3 | // HackingSFViewController 4 | // 5 | // Created by stringCode on 10/10/2015. 6 | // Copyright © 2015 stringCode. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import SafariServices 11 | 12 | class SCSafariViewController: SFSafariViewController { 13 | var edgeView: UIView? { 14 | get { 15 | if (_edgeView == nil && isViewLoaded()) { 16 | _edgeView = UIView() 17 | _edgeView?.translatesAutoresizingMaskIntoConstraints = false 18 | view.addSubview(_edgeView!) 19 | _edgeView?.backgroundColor = UIColor(white: 1.0, alpha: 0.005) 20 | let bindings = ["edgeView": _edgeView!] 21 | let options = NSLayoutFormatOptions(rawValue: 0) 22 | let hConstraints = NSLayoutConstraint.constraintsWithVisualFormat("|-0-[edgeView(5)]", options: options, metrics: nil, views: bindings) 23 | let vConstraints = NSLayoutConstraint.constraintsWithVisualFormat("V:|-0-[edgeView]-0-|", options: options, metrics: nil, views: bindings) 24 | view?.addConstraints(hConstraints) 25 | view?.addConstraints(vConstraints) 26 | } 27 | return _edgeView 28 | } 29 | } 30 | 31 | private var _edgeView: UIView? 32 | 33 | } -------------------------------------------------------------------------------- /HackingSFViewController/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // HackingSFViewController 4 | // 5 | // Created by stringCode on 10/10/2015. 6 | // Copyright © 2015 stringCode. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import SafariServices 11 | 12 | class ViewController: UIViewController, SFSafariViewControllerDelegate, UIViewControllerTransitioningDelegate { 13 | 14 | let animator = SCModalPushPopAnimator() 15 | 16 | @IBAction func showSafariViewController(sender: AnyObject){ 17 | let safariViewController = SCSafariViewController(URL: NSURL(string: "http://www.stringcode.co.uk")!) 18 | safariViewController.delegate = self; 19 | safariViewController.transitioningDelegate = self 20 | self.presentViewController(safariViewController, animated: true) { () -> Void in 21 | let recognizer = UIScreenEdgePanGestureRecognizer(target: self, action: "handleGesture:") 22 | recognizer.edges = UIRectEdge.Left 23 | safariViewController.edgeView?.addGestureRecognizer(recognizer) 24 | } 25 | } 26 | 27 | func handleGesture(recognizer:UIScreenEdgePanGestureRecognizer) { 28 | self.animator.percentageDriven = true 29 | let percentComplete = recognizer.locationInView(view).x / view.bounds.size.width / 2.0 30 | switch recognizer.state { 31 | case .Began: dismissViewControllerAnimated(true, completion: nil) 32 | case .Changed: animator.updateInteractiveTransition(percentComplete > 0.99 ? 0.99 : percentComplete) 33 | case .Ended, .Cancelled: 34 | (recognizer.velocityInView(view).x < 0) ? animator.cancelInteractiveTransition() : animator.finishInteractiveTransition() 35 | self.animator.percentageDriven = false 36 | default: () 37 | } 38 | } 39 | 40 | func safariViewControllerDidFinish(controller: SFSafariViewController) { 41 | self.dismissViewControllerAnimated(true, completion: nil) 42 | } 43 | 44 | func animationControllerForPresentedController(presented: UIViewController, presentingController presenting: UIViewController, sourceController source: UIViewController) -> UIViewControllerAnimatedTransitioning? { 45 | animator.dismissing = false 46 | return animator 47 | } 48 | 49 | func animationControllerForDismissedController(dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? { 50 | animator.dismissing = true 51 | return animator 52 | } 53 | 54 | func interactionControllerForDismissal(animator: UIViewControllerAnimatedTransitioning) -> UIViewControllerInteractiveTransitioning? { 55 | return self.animator.percentageDriven ? self.animator : nil 56 | } 57 | 58 | } 59 | 60 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 stringcode86 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 | # SCSafariViewController 2 | Push / Pop modal SFSafariViewController (Hacking swipe from edge gesture). 3 | 4 | For more details hear over to [stringcode.co.uk](http://www.stringcode.co.uk/push-pop-modal-sfsafariviewcontroller-hacking-swipe-from-edge-gesture/) 5 | -------------------------------------------------------------------------------- /SCSafariViewController.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stringcode86/SCSafariViewController/74dc931882cf7f0b5565cf3dec1bca7db03bedc8/SCSafariViewController.gif --------------------------------------------------------------------------------