├── .gitignore ├── .swift-version ├── CrossNavigationController.podspec ├── CrossNavigationController.xcodeproj ├── CrossNavigationControllerTests_Info.plist ├── CrossNavigationController_Info.plist ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcshareddata │ └── xcschemes │ ├── CrossNavigationController.xcscheme │ └── xcschememanagement.plist ├── Example ├── Example.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata └── Example │ ├── AppDelegate.swift │ ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── GestureViewController.swift │ ├── GoalViewController.swift │ ├── Info.plist │ ├── MenuViewController.swift │ ├── NavigationController.swift │ ├── StartViewController.swift │ ├── UIStoryboard.swift │ └── ViewController.swift ├── LICENSE ├── Package.swift ├── README.md └── Sources ├── Cross+Animator.swift ├── Cross.swift ├── CrossControllable.swift ├── CrossNavigationController.h ├── CrossNavigationController.swift ├── CrossPanGestureRecognizer.swift └── CrossViewController.swift /.gitignore: -------------------------------------------------------------------------------- 1 | # Mac 2 | .DS_Store 3 | 4 | # Xcode 5 | build/* 6 | *.pbxuser 7 | !default.pbxuser 8 | *.mode1v3 9 | !default.mode1v3 10 | *.mode2v3 11 | !default.mode2v3 12 | *.perspectivev3 13 | !default.perspectivev3 14 | xcuserdata 15 | profile 16 | *.moved-aside 17 | DerivedData 18 | .idea/ 19 | 20 | *.ipa 21 | *.app 22 | 23 | *.xccheckout 24 | sort-Xcode-project-file -------------------------------------------------------------------------------- /.swift-version: -------------------------------------------------------------------------------- 1 | 3.0 2 | -------------------------------------------------------------------------------- /CrossNavigationController.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "CrossNavigationController" 3 | s.version = "0.5.0" 4 | s.summary = "Move to cross using UINavigationController." 5 | s.homepage = "https://github.com/hryk224/CrossNavigationController" 6 | s.screenshots = "https://github.com/hryk224/CrossNavigationController/wiki/images/sample.gif" 7 | s.license = { :type => "MIT", :file => "LICENSE" } 8 | s.author = { "hyyk224" => "hryk224@gmail.com" } 9 | s.platform = :ios, "9.0" 10 | s.source = { :git => "https://github.com/hryk224/CrossNavigationController.git", :tag => "#{s.version}" } 11 | s.source_files = "Sources/*.{h,swift}" 12 | s.frameworks = "UIKit" 13 | s.requires_arc = true 14 | end 15 | -------------------------------------------------------------------------------- /CrossNavigationController.xcodeproj/CrossNavigationControllerTests_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | BNDL 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /CrossNavigationController.xcodeproj/CrossNavigationController_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 | FMWK 17 | CFBundleShortVersionString 18 | 0.5.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /CrossNavigationController.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 93A4135D1E56308A00473E77 /* Cross.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93A413561E56308A00473E77 /* Cross.swift */; }; 11 | 93A4135E1E56308A00473E77 /* Cross+Animator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93A413571E56308A00473E77 /* Cross+Animator.swift */; }; 12 | 93A4135F1E56308A00473E77 /* CrossControllable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93A413581E56308A00473E77 /* CrossControllable.swift */; }; 13 | 93A413601E56308A00473E77 /* CrossNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93A4135A1E56308A00473E77 /* CrossNavigationController.swift */; }; 14 | 93A413611E56308A00473E77 /* CrossPanGestureRecognizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93A4135B1E56308A00473E77 /* CrossPanGestureRecognizer.swift */; }; 15 | 93A413621E56308A00473E77 /* CrossViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93A4135C1E56308A00473E77 /* CrossViewController.swift */; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXFileReference section */ 19 | 93A413561E56308A00473E77 /* Cross.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Cross.swift; sourceTree = ""; }; 20 | 93A413571E56308A00473E77 /* Cross+Animator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Cross+Animator.swift"; sourceTree = ""; }; 21 | 93A413581E56308A00473E77 /* CrossControllable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CrossControllable.swift; sourceTree = ""; }; 22 | 93A413591E56308A00473E77 /* CrossNavigationController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CrossNavigationController.h; sourceTree = ""; }; 23 | 93A4135A1E56308A00473E77 /* CrossNavigationController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CrossNavigationController.swift; sourceTree = ""; }; 24 | 93A4135B1E56308A00473E77 /* CrossPanGestureRecognizer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CrossPanGestureRecognizer.swift; sourceTree = ""; }; 25 | 93A4135C1E56308A00473E77 /* CrossViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CrossViewController.swift; sourceTree = ""; }; 26 | OBJ_15 /* CrossNavigationController.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = CrossNavigationController.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 27 | OBJ_6 /* Package.swift */ = {isa = PBXFileReference; explicitFileType = sourcecode.swift; path = Package.swift; sourceTree = ""; }; 28 | /* End PBXFileReference section */ 29 | 30 | /* Begin PBXFrameworksBuildPhase section */ 31 | OBJ_23 /* Frameworks */ = { 32 | isa = PBXFrameworksBuildPhase; 33 | buildActionMask = 0; 34 | files = ( 35 | ); 36 | runOnlyForDeploymentPostprocessing = 0; 37 | }; 38 | /* End PBXFrameworksBuildPhase section */ 39 | 40 | /* Begin PBXGroup section */ 41 | OBJ_14 /* Products */ = { 42 | isa = PBXGroup; 43 | children = ( 44 | OBJ_15 /* CrossNavigationController.framework */, 45 | ); 46 | name = Products; 47 | sourceTree = BUILT_PRODUCTS_DIR; 48 | }; 49 | OBJ_5 = { 50 | isa = PBXGroup; 51 | children = ( 52 | OBJ_6 /* Package.swift */, 53 | OBJ_7 /* Sources */, 54 | OBJ_14 /* Products */, 55 | ); 56 | sourceTree = ""; 57 | }; 58 | OBJ_7 /* Sources */ = { 59 | isa = PBXGroup; 60 | children = ( 61 | OBJ_8 /* CrossNavigationController */, 62 | ); 63 | path = Sources; 64 | sourceTree = ""; 65 | }; 66 | OBJ_8 /* CrossNavigationController */ = { 67 | isa = PBXGroup; 68 | children = ( 69 | 93A413571E56308A00473E77 /* Cross+Animator.swift */, 70 | 93A413561E56308A00473E77 /* Cross.swift */, 71 | 93A413581E56308A00473E77 /* CrossControllable.swift */, 72 | 93A413591E56308A00473E77 /* CrossNavigationController.h */, 73 | 93A4135A1E56308A00473E77 /* CrossNavigationController.swift */, 74 | 93A4135B1E56308A00473E77 /* CrossPanGestureRecognizer.swift */, 75 | 93A4135C1E56308A00473E77 /* CrossViewController.swift */, 76 | ); 77 | name = CrossNavigationController; 78 | path = Sources; 79 | sourceTree = SOURCE_ROOT; 80 | }; 81 | /* End PBXGroup section */ 82 | 83 | /* Begin PBXNativeTarget section */ 84 | OBJ_17 /* CrossNavigationController */ = { 85 | isa = PBXNativeTarget; 86 | buildConfigurationList = OBJ_18 /* Build configuration list for PBXNativeTarget "CrossNavigationController" */; 87 | buildPhases = ( 88 | OBJ_21 /* Sources */, 89 | OBJ_23 /* Frameworks */, 90 | ); 91 | buildRules = ( 92 | ); 93 | dependencies = ( 94 | ); 95 | name = CrossNavigationController; 96 | productName = CrossNavigationController; 97 | productReference = OBJ_15 /* CrossNavigationController.framework */; 98 | productType = "com.apple.product-type.framework"; 99 | }; 100 | /* End PBXNativeTarget section */ 101 | 102 | /* Begin PBXProject section */ 103 | OBJ_1 /* Project object */ = { 104 | isa = PBXProject; 105 | attributes = { 106 | LastUpgradeCheck = 9999; 107 | TargetAttributes = { 108 | OBJ_17 = { 109 | LastSwiftMigration = 0820; 110 | }; 111 | }; 112 | }; 113 | buildConfigurationList = OBJ_2 /* Build configuration list for PBXProject "CrossNavigationController" */; 114 | compatibilityVersion = "Xcode 3.2"; 115 | developmentRegion = English; 116 | hasScannedForEncodings = 0; 117 | knownRegions = ( 118 | en, 119 | ); 120 | mainGroup = OBJ_5; 121 | productRefGroup = OBJ_14 /* Products */; 122 | projectDirPath = ""; 123 | projectRoot = ""; 124 | targets = ( 125 | OBJ_17 /* CrossNavigationController */, 126 | ); 127 | }; 128 | /* End PBXProject section */ 129 | 130 | /* Begin PBXSourcesBuildPhase section */ 131 | OBJ_21 /* Sources */ = { 132 | isa = PBXSourcesBuildPhase; 133 | buildActionMask = 0; 134 | files = ( 135 | 93A4135E1E56308A00473E77 /* Cross+Animator.swift in Sources */, 136 | 93A4135D1E56308A00473E77 /* Cross.swift in Sources */, 137 | 93A4135F1E56308A00473E77 /* CrossControllable.swift in Sources */, 138 | 93A413601E56308A00473E77 /* CrossNavigationController.swift in Sources */, 139 | 93A413611E56308A00473E77 /* CrossPanGestureRecognizer.swift in Sources */, 140 | 93A413621E56308A00473E77 /* CrossViewController.swift in Sources */, 141 | ); 142 | runOnlyForDeploymentPostprocessing = 0; 143 | }; 144 | /* End PBXSourcesBuildPhase section */ 145 | 146 | /* Begin XCBuildConfiguration section */ 147 | OBJ_19 /* Debug */ = { 148 | isa = XCBuildConfiguration; 149 | buildSettings = { 150 | CLANG_ENABLE_MODULES = YES; 151 | DEFINES_MODULE = YES; 152 | ENABLE_TESTABILITY = YES; 153 | FRAMEWORK_SEARCH_PATHS = ( 154 | "$(inherited)", 155 | "$(PLATFORM_DIR)/Developer/Library/Frameworks", 156 | ); 157 | HEADER_SEARCH_PATHS = "$(inherited)"; 158 | INFOPLIST_FILE = CrossNavigationController.xcodeproj/CrossNavigationController_Info.plist; 159 | LD_RUNPATH_SEARCH_PATHS = "$(TOOLCHAIN_DIR)/usr/lib/swift/macosx"; 160 | OTHER_LDFLAGS = "$(inherited)"; 161 | OTHER_SWIFT_FLAGS = "$(inherited)"; 162 | PRODUCT_BUNDLE_IDENTIFIER = CrossNavigationController; 163 | PRODUCT_MODULE_NAME = "$(TARGET_NAME:c99extidentifier)"; 164 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; 165 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 166 | SWIFT_VERSION = 3.0; 167 | TARGET_NAME = CrossNavigationController; 168 | }; 169 | name = Debug; 170 | }; 171 | OBJ_20 /* Release */ = { 172 | isa = XCBuildConfiguration; 173 | buildSettings = { 174 | CLANG_ENABLE_MODULES = YES; 175 | DEFINES_MODULE = YES; 176 | ENABLE_TESTABILITY = YES; 177 | FRAMEWORK_SEARCH_PATHS = ( 178 | "$(inherited)", 179 | "$(PLATFORM_DIR)/Developer/Library/Frameworks", 180 | ); 181 | HEADER_SEARCH_PATHS = "$(inherited)"; 182 | INFOPLIST_FILE = CrossNavigationController.xcodeproj/CrossNavigationController_Info.plist; 183 | LD_RUNPATH_SEARCH_PATHS = "$(TOOLCHAIN_DIR)/usr/lib/swift/macosx"; 184 | OTHER_LDFLAGS = "$(inherited)"; 185 | OTHER_SWIFT_FLAGS = "$(inherited)"; 186 | PRODUCT_BUNDLE_IDENTIFIER = CrossNavigationController; 187 | PRODUCT_MODULE_NAME = "$(TARGET_NAME:c99extidentifier)"; 188 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; 189 | SWIFT_VERSION = 3.0; 190 | TARGET_NAME = CrossNavigationController; 191 | }; 192 | name = Release; 193 | }; 194 | OBJ_3 /* Debug */ = { 195 | isa = XCBuildConfiguration; 196 | buildSettings = { 197 | COMBINE_HIDPI_IMAGES = YES; 198 | COPY_PHASE_STRIP = NO; 199 | DEBUG_INFORMATION_FORMAT = dwarf; 200 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 201 | ENABLE_NS_ASSERTIONS = YES; 202 | GCC_OPTIMIZATION_LEVEL = 0; 203 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 204 | MACOSX_DEPLOYMENT_TARGET = 10.10; 205 | ONLY_ACTIVE_ARCH = YES; 206 | OTHER_SWIFT_FLAGS = "-DXcode"; 207 | PRODUCT_NAME = "$(TARGET_NAME)"; 208 | SDKROOT = iphoneos10.2; 209 | SUPPORTED_PLATFORMS = "iphonesimulator iphoneos"; 210 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = SWIFT_PACKAGE; 211 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 212 | SWIFT_VERSION = 3.0; 213 | USE_HEADERMAP = NO; 214 | }; 215 | name = Debug; 216 | }; 217 | OBJ_4 /* Release */ = { 218 | isa = XCBuildConfiguration; 219 | buildSettings = { 220 | COMBINE_HIDPI_IMAGES = YES; 221 | COPY_PHASE_STRIP = YES; 222 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 223 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 224 | GCC_OPTIMIZATION_LEVEL = s; 225 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 226 | MACOSX_DEPLOYMENT_TARGET = 10.10; 227 | OTHER_SWIFT_FLAGS = "-DXcode"; 228 | PRODUCT_NAME = "$(TARGET_NAME)"; 229 | SDKROOT = iphoneos10.2; 230 | SUPPORTED_PLATFORMS = "iphonesimulator iphoneos"; 231 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = SWIFT_PACKAGE; 232 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 233 | SWIFT_VERSION = 3.0; 234 | USE_HEADERMAP = NO; 235 | }; 236 | name = Release; 237 | }; 238 | /* End XCBuildConfiguration section */ 239 | 240 | /* Begin XCConfigurationList section */ 241 | OBJ_18 /* Build configuration list for PBXNativeTarget "CrossNavigationController" */ = { 242 | isa = XCConfigurationList; 243 | buildConfigurations = ( 244 | OBJ_19 /* Debug */, 245 | OBJ_20 /* Release */, 246 | ); 247 | defaultConfigurationIsVisible = 0; 248 | defaultConfigurationName = Debug; 249 | }; 250 | OBJ_2 /* Build configuration list for PBXProject "CrossNavigationController" */ = { 251 | isa = XCConfigurationList; 252 | buildConfigurations = ( 253 | OBJ_3 /* Debug */, 254 | OBJ_4 /* Release */, 255 | ); 256 | defaultConfigurationIsVisible = 0; 257 | defaultConfigurationName = Debug; 258 | }; 259 | /* End XCConfigurationList section */ 260 | }; 261 | rootObject = OBJ_1 /* Project object */; 262 | } 263 | -------------------------------------------------------------------------------- /CrossNavigationController.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /CrossNavigationController.xcodeproj/xcshareddata/xcschemes/CrossNavigationController.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 55 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 74 | 76 | 77 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /CrossNavigationController.xcodeproj/xcshareddata/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | SchemeUserState 5 | 6 | CrossNavigationController.xcscheme 7 | 8 | 9 | SuppressBuildableAutocreation 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Example/Example.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | ED1FD7C71DD07711005A3ABF /* CrossNavigationController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ED1FD7C61DD0770C005A3ABF /* CrossNavigationController.framework */; }; 11 | ED1FD7C81DD07711005A3ABF /* CrossNavigationController.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = ED1FD7C61DD0770C005A3ABF /* CrossNavigationController.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 12 | ED5BBA8B1DD1B8D300117FE5 /* MenuViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED5BBA8A1DD1B8D300117FE5 /* MenuViewController.swift */; }; 13 | ED5BBA8D1DD1BBC100117FE5 /* StartViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED5BBA8C1DD1BBC100117FE5 /* StartViewController.swift */; }; 14 | ED5BBA8F1DD1BBD700117FE5 /* GoalViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED5BBA8E1DD1BBD700117FE5 /* GoalViewController.swift */; }; 15 | ED5BBA961DD1CEF600117FE5 /* GestureViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED5BBA951DD1CEF600117FE5 /* GestureViewController.swift */; }; 16 | ED5BBA981DD1D0C000117FE5 /* UIStoryboard.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED5BBA971DD1D0C000117FE5 /* UIStoryboard.swift */; }; 17 | EDF621C71DCC2D29007736BB /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = EDF621C61DCC2D29007736BB /* AppDelegate.swift */; }; 18 | EDF621C91DCC2D29007736BB /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EDF621C81DCC2D29007736BB /* ViewController.swift */; }; 19 | EDF621CC1DCC2D29007736BB /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = EDF621CA1DCC2D29007736BB /* Main.storyboard */; }; 20 | EDF621CE1DCC2D29007736BB /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = EDF621CD1DCC2D29007736BB /* Assets.xcassets */; }; 21 | EDF621D11DCC2D29007736BB /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = EDF621CF1DCC2D29007736BB /* LaunchScreen.storyboard */; }; 22 | EDF622261DCC2FFC007736BB /* NavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EDF622251DCC2FFC007736BB /* NavigationController.swift */; }; 23 | /* End PBXBuildFile section */ 24 | 25 | /* Begin PBXContainerItemProxy section */ 26 | ED1FD7C51DD0770C005A3ABF /* PBXContainerItemProxy */ = { 27 | isa = PBXContainerItemProxy; 28 | containerPortal = ED1FD7C11DD0770C005A3ABF /* CrossNavigationController.xcodeproj */; 29 | proxyType = 2; 30 | remoteGlobalIDString = EDF622311DCC32E7007736BB; 31 | remoteInfo = CrossNavigationController; 32 | }; 33 | ED1FD7C91DD07711005A3ABF /* PBXContainerItemProxy */ = { 34 | isa = PBXContainerItemProxy; 35 | containerPortal = ED1FD7C11DD0770C005A3ABF /* CrossNavigationController.xcodeproj */; 36 | proxyType = 1; 37 | remoteGlobalIDString = OBJ_17; 38 | remoteInfo = CrossNavigationController; 39 | }; 40 | /* End PBXContainerItemProxy section */ 41 | 42 | /* Begin PBXCopyFilesBuildPhase section */ 43 | ED1FD7BF1DD0763B005A3ABF /* Embed Frameworks */ = { 44 | isa = PBXCopyFilesBuildPhase; 45 | buildActionMask = 2147483647; 46 | dstPath = ""; 47 | dstSubfolderSpec = 10; 48 | files = ( 49 | ED1FD7C81DD07711005A3ABF /* CrossNavigationController.framework in Embed Frameworks */, 50 | ); 51 | name = "Embed Frameworks"; 52 | runOnlyForDeploymentPostprocessing = 0; 53 | }; 54 | /* End PBXCopyFilesBuildPhase section */ 55 | 56 | /* Begin PBXFileReference section */ 57 | ED1FD7C11DD0770C005A3ABF /* CrossNavigationController.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = CrossNavigationController.xcodeproj; path = ../CrossNavigationController.xcodeproj; sourceTree = ""; }; 58 | ED5BBA8A1DD1B8D300117FE5 /* MenuViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MenuViewController.swift; sourceTree = ""; }; 59 | ED5BBA8C1DD1BBC100117FE5 /* StartViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StartViewController.swift; sourceTree = ""; }; 60 | ED5BBA8E1DD1BBD700117FE5 /* GoalViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GoalViewController.swift; sourceTree = ""; }; 61 | ED5BBA951DD1CEF600117FE5 /* GestureViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GestureViewController.swift; sourceTree = ""; }; 62 | ED5BBA971DD1D0C000117FE5 /* UIStoryboard.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIStoryboard.swift; sourceTree = ""; }; 63 | EDF621C31DCC2D29007736BB /* Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 64 | EDF621C61DCC2D29007736BB /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 65 | EDF621C81DCC2D29007736BB /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 66 | EDF621CB1DCC2D29007736BB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 67 | EDF621CD1DCC2D29007736BB /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 68 | EDF621D01DCC2D29007736BB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 69 | EDF621D21DCC2D29007736BB /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 70 | EDF622251DCC2FFC007736BB /* NavigationController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NavigationController.swift; sourceTree = ""; }; 71 | /* End PBXFileReference section */ 72 | 73 | /* Begin PBXFrameworksBuildPhase section */ 74 | EDF621C01DCC2D29007736BB /* Frameworks */ = { 75 | isa = PBXFrameworksBuildPhase; 76 | buildActionMask = 2147483647; 77 | files = ( 78 | ED1FD7C71DD07711005A3ABF /* CrossNavigationController.framework in Frameworks */, 79 | ); 80 | runOnlyForDeploymentPostprocessing = 0; 81 | }; 82 | /* End PBXFrameworksBuildPhase section */ 83 | 84 | /* Begin PBXGroup section */ 85 | ED1FD7C01DD0770C005A3ABF /* Frameworks */ = { 86 | isa = PBXGroup; 87 | children = ( 88 | ED1FD7C11DD0770C005A3ABF /* CrossNavigationController.xcodeproj */, 89 | ); 90 | name = Frameworks; 91 | sourceTree = ""; 92 | }; 93 | ED1FD7C21DD0770C005A3ABF /* Products */ = { 94 | isa = PBXGroup; 95 | children = ( 96 | ED1FD7C61DD0770C005A3ABF /* CrossNavigationController.framework */, 97 | ); 98 | name = Products; 99 | sourceTree = ""; 100 | }; 101 | ED5BBA901DD1BBE800117FE5 /* NavigationController */ = { 102 | isa = PBXGroup; 103 | children = ( 104 | EDF622251DCC2FFC007736BB /* NavigationController.swift */, 105 | ); 106 | name = NavigationController; 107 | sourceTree = ""; 108 | }; 109 | ED5BBA911DD1BBFD00117FE5 /* Simple */ = { 110 | isa = PBXGroup; 111 | children = ( 112 | ED5BBA8E1DD1BBD700117FE5 /* GoalViewController.swift */, 113 | ED5BBA8C1DD1BBC100117FE5 /* StartViewController.swift */, 114 | EDF621C81DCC2D29007736BB /* ViewController.swift */, 115 | ); 116 | name = Simple; 117 | sourceTree = ""; 118 | }; 119 | ED5BBA941DD1CEE500117FE5 /* Gesture */ = { 120 | isa = PBXGroup; 121 | children = ( 122 | ED5BBA951DD1CEF600117FE5 /* GestureViewController.swift */, 123 | ); 124 | name = Gesture; 125 | sourceTree = ""; 126 | }; 127 | EDF621BA1DCC2D29007736BB = { 128 | isa = PBXGroup; 129 | children = ( 130 | EDF621C51DCC2D29007736BB /* Example */, 131 | ED1FD7C01DD0770C005A3ABF /* Frameworks */, 132 | EDF621C41DCC2D29007736BB /* Products */, 133 | ); 134 | sourceTree = ""; 135 | }; 136 | EDF621C41DCC2D29007736BB /* Products */ = { 137 | isa = PBXGroup; 138 | children = ( 139 | EDF621C31DCC2D29007736BB /* Example.app */, 140 | ); 141 | name = Products; 142 | sourceTree = ""; 143 | }; 144 | EDF621C51DCC2D29007736BB /* Example */ = { 145 | isa = PBXGroup; 146 | children = ( 147 | ED5BBA941DD1CEE500117FE5 /* Gesture */, 148 | ED5BBA901DD1BBE800117FE5 /* NavigationController */, 149 | ED5BBA911DD1BBFD00117FE5 /* Simple */, 150 | EDF621C61DCC2D29007736BB /* AppDelegate.swift */, 151 | EDF621CD1DCC2D29007736BB /* Assets.xcassets */, 152 | EDF621D21DCC2D29007736BB /* Info.plist */, 153 | EDF621CF1DCC2D29007736BB /* LaunchScreen.storyboard */, 154 | EDF621CA1DCC2D29007736BB /* Main.storyboard */, 155 | ED5BBA8A1DD1B8D300117FE5 /* MenuViewController.swift */, 156 | ED5BBA971DD1D0C000117FE5 /* UIStoryboard.swift */, 157 | ); 158 | path = Example; 159 | sourceTree = ""; 160 | }; 161 | /* End PBXGroup section */ 162 | 163 | /* Begin PBXNativeTarget section */ 164 | EDF621C21DCC2D29007736BB /* Example */ = { 165 | isa = PBXNativeTarget; 166 | buildConfigurationList = EDF621D51DCC2D29007736BB /* Build configuration list for PBXNativeTarget "Example" */; 167 | buildPhases = ( 168 | EDF621BF1DCC2D29007736BB /* Sources */, 169 | EDF621C01DCC2D29007736BB /* Frameworks */, 170 | EDF621C11DCC2D29007736BB /* Resources */, 171 | ED1FD7BF1DD0763B005A3ABF /* Embed Frameworks */, 172 | ); 173 | buildRules = ( 174 | ); 175 | dependencies = ( 176 | ED1FD7CA1DD07711005A3ABF /* PBXTargetDependency */, 177 | ); 178 | name = Example; 179 | productName = Example; 180 | productReference = EDF621C31DCC2D29007736BB /* Example.app */; 181 | productType = "com.apple.product-type.application"; 182 | }; 183 | /* End PBXNativeTarget section */ 184 | 185 | /* Begin PBXProject section */ 186 | EDF621BB1DCC2D29007736BB /* Project object */ = { 187 | isa = PBXProject; 188 | attributes = { 189 | LastSwiftUpdateCheck = 0810; 190 | LastUpgradeCheck = 0820; 191 | ORGANIZATIONNAME = hryk224; 192 | TargetAttributes = { 193 | EDF621C21DCC2D29007736BB = { 194 | CreatedOnToolsVersion = 8.1; 195 | DevelopmentTeam = RV3EBK3G3Y; 196 | ProvisioningStyle = Automatic; 197 | }; 198 | }; 199 | }; 200 | buildConfigurationList = EDF621BE1DCC2D29007736BB /* Build configuration list for PBXProject "Example" */; 201 | compatibilityVersion = "Xcode 3.2"; 202 | developmentRegion = English; 203 | hasScannedForEncodings = 0; 204 | knownRegions = ( 205 | en, 206 | Base, 207 | ); 208 | mainGroup = EDF621BA1DCC2D29007736BB; 209 | productRefGroup = EDF621C41DCC2D29007736BB /* Products */; 210 | projectDirPath = ""; 211 | projectReferences = ( 212 | { 213 | ProductGroup = ED1FD7C21DD0770C005A3ABF /* Products */; 214 | ProjectRef = ED1FD7C11DD0770C005A3ABF /* CrossNavigationController.xcodeproj */; 215 | }, 216 | ); 217 | projectRoot = ""; 218 | targets = ( 219 | EDF621C21DCC2D29007736BB /* Example */, 220 | ); 221 | }; 222 | /* End PBXProject section */ 223 | 224 | /* Begin PBXReferenceProxy section */ 225 | ED1FD7C61DD0770C005A3ABF /* CrossNavigationController.framework */ = { 226 | isa = PBXReferenceProxy; 227 | fileType = wrapper.framework; 228 | path = CrossNavigationController.framework; 229 | remoteRef = ED1FD7C51DD0770C005A3ABF /* PBXContainerItemProxy */; 230 | sourceTree = BUILT_PRODUCTS_DIR; 231 | }; 232 | /* End PBXReferenceProxy section */ 233 | 234 | /* Begin PBXResourcesBuildPhase section */ 235 | EDF621C11DCC2D29007736BB /* Resources */ = { 236 | isa = PBXResourcesBuildPhase; 237 | buildActionMask = 2147483647; 238 | files = ( 239 | EDF621CE1DCC2D29007736BB /* Assets.xcassets in Resources */, 240 | EDF621D11DCC2D29007736BB /* LaunchScreen.storyboard in Resources */, 241 | EDF621CC1DCC2D29007736BB /* Main.storyboard in Resources */, 242 | ); 243 | runOnlyForDeploymentPostprocessing = 0; 244 | }; 245 | /* End PBXResourcesBuildPhase section */ 246 | 247 | /* Begin PBXSourcesBuildPhase section */ 248 | EDF621BF1DCC2D29007736BB /* Sources */ = { 249 | isa = PBXSourcesBuildPhase; 250 | buildActionMask = 2147483647; 251 | files = ( 252 | EDF621C71DCC2D29007736BB /* AppDelegate.swift in Sources */, 253 | ED5BBA961DD1CEF600117FE5 /* GestureViewController.swift in Sources */, 254 | ED5BBA8F1DD1BBD700117FE5 /* GoalViewController.swift in Sources */, 255 | ED5BBA8B1DD1B8D300117FE5 /* MenuViewController.swift in Sources */, 256 | EDF622261DCC2FFC007736BB /* NavigationController.swift in Sources */, 257 | ED5BBA8D1DD1BBC100117FE5 /* StartViewController.swift in Sources */, 258 | ED5BBA981DD1D0C000117FE5 /* UIStoryboard.swift in Sources */, 259 | EDF621C91DCC2D29007736BB /* ViewController.swift in Sources */, 260 | ); 261 | runOnlyForDeploymentPostprocessing = 0; 262 | }; 263 | /* End PBXSourcesBuildPhase section */ 264 | 265 | /* Begin PBXTargetDependency section */ 266 | ED1FD7CA1DD07711005A3ABF /* PBXTargetDependency */ = { 267 | isa = PBXTargetDependency; 268 | name = CrossNavigationController; 269 | targetProxy = ED1FD7C91DD07711005A3ABF /* PBXContainerItemProxy */; 270 | }; 271 | /* End PBXTargetDependency section */ 272 | 273 | /* Begin PBXVariantGroup section */ 274 | EDF621CA1DCC2D29007736BB /* Main.storyboard */ = { 275 | isa = PBXVariantGroup; 276 | children = ( 277 | EDF621CB1DCC2D29007736BB /* Base */, 278 | ); 279 | name = Main.storyboard; 280 | sourceTree = ""; 281 | }; 282 | EDF621CF1DCC2D29007736BB /* LaunchScreen.storyboard */ = { 283 | isa = PBXVariantGroup; 284 | children = ( 285 | EDF621D01DCC2D29007736BB /* Base */, 286 | ); 287 | name = LaunchScreen.storyboard; 288 | sourceTree = ""; 289 | }; 290 | /* End PBXVariantGroup section */ 291 | 292 | /* Begin XCBuildConfiguration section */ 293 | EDF621D31DCC2D29007736BB /* Debug */ = { 294 | isa = XCBuildConfiguration; 295 | buildSettings = { 296 | ALWAYS_SEARCH_USER_PATHS = NO; 297 | CLANG_ANALYZER_NONNULL = YES; 298 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 299 | CLANG_CXX_LIBRARY = "libc++"; 300 | CLANG_ENABLE_MODULES = YES; 301 | CLANG_ENABLE_OBJC_ARC = YES; 302 | CLANG_WARN_BOOL_CONVERSION = YES; 303 | CLANG_WARN_CONSTANT_CONVERSION = YES; 304 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 305 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 306 | CLANG_WARN_EMPTY_BODY = YES; 307 | CLANG_WARN_ENUM_CONVERSION = YES; 308 | CLANG_WARN_INFINITE_RECURSION = YES; 309 | CLANG_WARN_INT_CONVERSION = YES; 310 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 311 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 312 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 313 | CLANG_WARN_UNREACHABLE_CODE = YES; 314 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 315 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 316 | COPY_PHASE_STRIP = NO; 317 | DEBUG_INFORMATION_FORMAT = dwarf; 318 | ENABLE_STRICT_OBJC_MSGSEND = YES; 319 | ENABLE_TESTABILITY = YES; 320 | GCC_C_LANGUAGE_STANDARD = gnu99; 321 | GCC_DYNAMIC_NO_PIC = NO; 322 | GCC_NO_COMMON_BLOCKS = YES; 323 | GCC_OPTIMIZATION_LEVEL = 0; 324 | GCC_PREPROCESSOR_DEFINITIONS = ( 325 | "DEBUG=1", 326 | "$(inherited)", 327 | ); 328 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 329 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 330 | GCC_WARN_UNDECLARED_SELECTOR = YES; 331 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 332 | GCC_WARN_UNUSED_FUNCTION = YES; 333 | GCC_WARN_UNUSED_VARIABLE = YES; 334 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 335 | MTL_ENABLE_DEBUG_INFO = YES; 336 | ONLY_ACTIVE_ARCH = YES; 337 | SDKROOT = iphoneos; 338 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 339 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 340 | TARGETED_DEVICE_FAMILY = "1,2"; 341 | }; 342 | name = Debug; 343 | }; 344 | EDF621D41DCC2D29007736BB /* Release */ = { 345 | isa = XCBuildConfiguration; 346 | buildSettings = { 347 | ALWAYS_SEARCH_USER_PATHS = NO; 348 | CLANG_ANALYZER_NONNULL = YES; 349 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 350 | CLANG_CXX_LIBRARY = "libc++"; 351 | CLANG_ENABLE_MODULES = YES; 352 | CLANG_ENABLE_OBJC_ARC = YES; 353 | CLANG_WARN_BOOL_CONVERSION = YES; 354 | CLANG_WARN_CONSTANT_CONVERSION = YES; 355 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 356 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 357 | CLANG_WARN_EMPTY_BODY = YES; 358 | CLANG_WARN_ENUM_CONVERSION = YES; 359 | CLANG_WARN_INFINITE_RECURSION = YES; 360 | CLANG_WARN_INT_CONVERSION = YES; 361 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 362 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 363 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 364 | CLANG_WARN_UNREACHABLE_CODE = YES; 365 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 366 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 367 | COPY_PHASE_STRIP = NO; 368 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 369 | ENABLE_NS_ASSERTIONS = NO; 370 | ENABLE_STRICT_OBJC_MSGSEND = YES; 371 | GCC_C_LANGUAGE_STANDARD = gnu99; 372 | GCC_NO_COMMON_BLOCKS = YES; 373 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 374 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 375 | GCC_WARN_UNDECLARED_SELECTOR = YES; 376 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 377 | GCC_WARN_UNUSED_FUNCTION = YES; 378 | GCC_WARN_UNUSED_VARIABLE = YES; 379 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 380 | MTL_ENABLE_DEBUG_INFO = NO; 381 | SDKROOT = iphoneos; 382 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 383 | TARGETED_DEVICE_FAMILY = "1,2"; 384 | VALIDATE_PRODUCT = YES; 385 | }; 386 | name = Release; 387 | }; 388 | EDF621D61DCC2D29007736BB /* Debug */ = { 389 | isa = XCBuildConfiguration; 390 | buildSettings = { 391 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 392 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 393 | DEVELOPMENT_TEAM = RV3EBK3G3Y; 394 | INFOPLIST_FILE = Example/Info.plist; 395 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 396 | PRODUCT_BUNDLE_IDENTIFIER = io.github.hryk224.Example; 397 | PRODUCT_NAME = "$(TARGET_NAME)"; 398 | SWIFT_VERSION = 3.0; 399 | }; 400 | name = Debug; 401 | }; 402 | EDF621D71DCC2D29007736BB /* Release */ = { 403 | isa = XCBuildConfiguration; 404 | buildSettings = { 405 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 406 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 407 | DEVELOPMENT_TEAM = RV3EBK3G3Y; 408 | INFOPLIST_FILE = Example/Info.plist; 409 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 410 | PRODUCT_BUNDLE_IDENTIFIER = io.github.hryk224.Example; 411 | PRODUCT_NAME = "$(TARGET_NAME)"; 412 | SWIFT_VERSION = 3.0; 413 | }; 414 | name = Release; 415 | }; 416 | /* End XCBuildConfiguration section */ 417 | 418 | /* Begin XCConfigurationList section */ 419 | EDF621BE1DCC2D29007736BB /* Build configuration list for PBXProject "Example" */ = { 420 | isa = XCConfigurationList; 421 | buildConfigurations = ( 422 | EDF621D31DCC2D29007736BB /* Debug */, 423 | EDF621D41DCC2D29007736BB /* Release */, 424 | ); 425 | defaultConfigurationIsVisible = 0; 426 | defaultConfigurationName = Release; 427 | }; 428 | EDF621D51DCC2D29007736BB /* Build configuration list for PBXNativeTarget "Example" */ = { 429 | isa = XCConfigurationList; 430 | buildConfigurations = ( 431 | EDF621D61DCC2D29007736BB /* Debug */, 432 | EDF621D71DCC2D29007736BB /* Release */, 433 | ); 434 | defaultConfigurationIsVisible = 0; 435 | defaultConfigurationName = Release; 436 | }; 437 | /* End XCConfigurationList section */ 438 | }; 439 | rootObject = EDF621BB1DCC2D29007736BB /* Project object */; 440 | } 441 | -------------------------------------------------------------------------------- /Example/Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/Example/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // Example 4 | // 5 | // Created by yoshida hiroyuki on 2016/11/04. 6 | // Copyright © 2016年 hryk224. 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 | 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 invalidate graphics rendering callbacks. 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 active 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 | -------------------------------------------------------------------------------- /Example/Example/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 | "info" : { 90 | "version" : 1, 91 | "author" : "xcode" 92 | } 93 | } -------------------------------------------------------------------------------- /Example/Example/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 | -------------------------------------------------------------------------------- /Example/Example/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 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 71 | 84 | 97 | 110 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 173 | 186 | 199 | 212 | 221 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 289 | 302 | 315 | 328 | 340 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 407 | 420 | 433 | 446 | 455 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | -------------------------------------------------------------------------------- /Example/Example/GestureViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GestureViewController.swift 3 | // Example 4 | // 5 | // Created by yoshida hiroyuki on 2016/11/08. 6 | // Copyright © 2016年 hryk224. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import CrossNavigationController 11 | 12 | final class GestureViewController: CrossViewController, CrossGestureControllable { 13 | 14 | @IBOutlet var upButton :UIButton! 15 | @IBOutlet var rightButton :UIButton! 16 | @IBOutlet var downButton :UIButton! 17 | @IBOutlet var leftButton :UIButton! 18 | @IBOutlet weak var label: UILabel! 19 | 20 | @IBAction func goRoot(_ sender: UIButton) { 21 | _ = crossNavigationController?.moveToRootViewController(animated: true) 22 | } 23 | 24 | @IBAction func goUp(_ sender: UIButton) { 25 | move(.up) 26 | } 27 | @IBAction func goRight(_ sender: UIButton) { 28 | move(.right) 29 | } 30 | @IBAction func goDown(_ sender: UIButton) { 31 | move(.down) 32 | } 33 | @IBAction func goLeft(_ sender: UIButton) { 34 | move(.left) 35 | } 36 | 37 | var upViewContoller: CrossViewController? { 38 | willSet { 39 | guard let _ = newValue else { return } 40 | addGestureRecognizer(.up) 41 | } 42 | } 43 | var rightViewContoller: CrossViewController? { 44 | willSet { 45 | guard let _ = newValue else { return } 46 | addGestureRecognizer(.right) 47 | } 48 | } 49 | var downViewContoller: CrossViewController? { 50 | willSet { 51 | guard let _ = newValue else { return } 52 | addGestureRecognizer(.down) 53 | } 54 | } 55 | var leftViewContoller: CrossViewController? { 56 | willSet { 57 | guard let _ = newValue else { return } 58 | addGestureRecognizer(.left) 59 | } 60 | } 61 | 62 | static func create() -> GestureViewController { 63 | let controller = UIStoryboard.main.instantiateViewController(withIdentifier: "GestureScene") as! GestureViewController 64 | return controller 65 | } 66 | 67 | override func viewDidLoad() { 68 | super.viewDidLoad() 69 | 70 | upViewContoller = GestureViewController.create() 71 | rightViewContoller = GestureViewController.create() 72 | downViewContoller = GestureViewController.create() 73 | leftViewContoller = GestureViewController.create() 74 | } 75 | 76 | override func viewWillAppear(_ animated: Bool) { 77 | super.viewWillAppear(animated) 78 | label.text = "x: \(coordinate.x) y: \(coordinate.y)" 79 | } 80 | 81 | } 82 | -------------------------------------------------------------------------------- /Example/Example/GoalViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GoalViewController.swift 3 | // Example 4 | // 5 | // Created by yoshida hiroyuki on 2016/11/08. 6 | // Copyright © 2016年 hryk224. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | final class GoalViewController: ViewController { 12 | override class func create() -> GoalViewController { 13 | return UIStoryboard.main.instantiateViewController(withIdentifier: "GoalScene") as! GoalViewController 14 | } 15 | @IBAction func goRoot(_ sender: UIButton) { 16 | _ = crossNavigationController?.moveToRootViewController(animated: true) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Example/Example/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 | 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 | -------------------------------------------------------------------------------- /Example/Example/MenuViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MenuViewController.swift 3 | // Example 4 | // 5 | // Created by yoshida hiroyuki on 2016/11/08. 6 | // Copyright © 2016年 hryk224. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | final class MenuViewController: UITableViewController { 12 | fileprivate let reuseIdentifier = "Cell" 13 | fileprivate let cells: [(title: String, color: UIColor)] = [("simple", .green), ("gesture", .red)] 14 | private var cellHeight: CGFloat { 15 | return tableView.bounds.height / CGFloat(cells.count) 16 | } 17 | override func viewDidLoad() { 18 | super.viewDidLoad() 19 | tableView.register(UITableViewCell.self, forCellReuseIdentifier: reuseIdentifier) 20 | tableView.rowHeight = cellHeight 21 | tableView.estimatedRowHeight = cellHeight 22 | } 23 | } 24 | 25 | // MARK: - UITableViewDelegate, UITableViewDataSource 26 | extension MenuViewController { 27 | override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 28 | return cells.count 29 | } 30 | override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 31 | let cell = tableView.dequeueReusableCell(withIdentifier: reuseIdentifier, for: indexPath) 32 | cell.textLabel?.text = cells[indexPath.row].title 33 | cell.textLabel?.font = UIFont.boldSystemFont(ofSize: 48) 34 | cell.textLabel?.textAlignment = .center 35 | cell.backgroundColor = cells[indexPath.row].color 36 | cell.selectionStyle = .none 37 | return cell 38 | } 39 | override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { 40 | switch indexPath.row { 41 | case 0: 42 | let navigationController = UIStoryboard.main.instantiateViewController(withIdentifier: "NaviScene") 43 | UIApplication.shared.keyWindow?.rootViewController = navigationController 44 | case 1: 45 | UIApplication.shared.keyWindow?.rootViewController = NavigationController(rootViewController: GestureViewController.create()) 46 | default: 47 | break 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Example/Example/NavigationController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NavigationController.swift 3 | // Example 4 | // 5 | // Created by yoshida hiroyuki on 2016/11/04. 6 | // Copyright © 2016年 hryk224. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import CrossNavigationController 11 | 12 | class NavigationController: CrossNavigationController { 13 | override func viewDidLoad() { 14 | super.viewDidLoad() 15 | navigationBar.isHidden = true 16 | 17 | // If change the start coordinates 18 | // setUp(initialCoordinate: (0, 0)) 19 | } 20 | } 21 | 22 | // MARK: - UINavigationcontrollerDelegate 23 | extension NavigationController { 24 | override func navigationController(_ navigationController: UINavigationController, animationControllerFor operation: UINavigationControllerOperation, from fromVC: UIViewController, to toVC: UIViewController) -> UIViewControllerAnimatedTransitioning? { 25 | // If use custom transion 26 | // return CustomTransionAnimator() 27 | return super.navigationController(navigationController, animationControllerFor: operation, from: fromVC, to: toVC) 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Example/Example/StartViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // StartViewController.swift 3 | // Example 4 | // 5 | // Created by yoshida hiroyuki on 2016/11/08. 6 | // Copyright © 2016年 hryk224. All rights reserved. 7 | // 8 | 9 | import UIKit.UILabel 10 | 11 | final class StartViewController: ViewController { 12 | @IBOutlet weak var startLabel: UILabel! { 13 | didSet { 14 | startLabel.layer.borderWidth = 1 15 | startLabel.layer.borderColor = startLabel.textColor.cgColor 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Example/Example/UIStoryboard.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIStoryboard.swift 3 | // Example 4 | // 5 | // Created by yoshida hiroyuki on 2016/11/08. 6 | // Copyright © 2016年 hryk224. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension UIStoryboard { 12 | static var main: UIStoryboard { 13 | return UIStoryboard(name: "Main", bundle: nil) 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Example/Example/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // Example 4 | // 5 | // Created by yoshida hiroyuki on 2016/11/04. 6 | // Copyright © 2016年 hryk224. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import CrossNavigationController 11 | 12 | class ViewController: CrossViewController { 13 | @IBOutlet var upButton :UIButton! 14 | @IBOutlet var rightButton :UIButton! 15 | @IBOutlet var downButton :UIButton! 16 | @IBOutlet var leftButton :UIButton! 17 | @IBOutlet weak var label: UILabel! 18 | 19 | private let goalCoordinate: Cross.Coordinate = (6, 5) 20 | 21 | @IBAction func goUp(_ sender: UIButton) { 22 | if coordinate == (goalCoordinate.x, goalCoordinate.y - 1) { 23 | crossNavigationController?.moveViewController(GoalViewController.create(), direction: .up, animated: true) 24 | } else { 25 | crossNavigationController?.moveViewController(ViewController.create(), direction: .up, animated: true) 26 | } 27 | } 28 | @IBAction func goRight(_ sender: UIButton) { 29 | if coordinate == (goalCoordinate.x - 1, goalCoordinate.y) { 30 | crossNavigationController?.moveViewController(GoalViewController.create(), direction: .right, animated: true) 31 | } else { 32 | crossNavigationController?.moveViewController(ViewController.create(), direction: .right, animated: true) 33 | } 34 | } 35 | @IBAction func goDown(_ sender: UIButton) { 36 | if coordinate == (goalCoordinate.x, goalCoordinate.y + 1) { 37 | crossNavigationController?.moveViewController(GoalViewController.create(), direction: .down, animated: true) 38 | } else { 39 | crossNavigationController?.moveViewController(ViewController.create(), direction: .down, animated: true) 40 | } 41 | } 42 | @IBAction func goLeft(_ sender: UIButton) { 43 | if coordinate == (goalCoordinate.x + 1, goalCoordinate.y) { 44 | crossNavigationController?.moveViewController(GoalViewController.create(), direction: .left, animated: true) 45 | } else { 46 | crossNavigationController?.moveViewController(ViewController.create(), direction: .left, animated: true) 47 | } 48 | } 49 | 50 | class func create() -> ViewController { 51 | let controller = UIStoryboard.main.instantiateViewController(withIdentifier: "Scene") as! ViewController 52 | return controller 53 | } 54 | 55 | override func viewWillAppear(_ animated: Bool) { 56 | super.viewWillAppear(animated) 57 | label.text = "x: \(coordinate.x) y: \(coordinate.y)" 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 hryk224 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 | -------------------------------------------------------------------------------- /Package.swift: -------------------------------------------------------------------------------- 1 | import PackageDescription 2 | 3 | let package = Package( 4 | name: "CrossNavigationController", 5 | targets: [], 6 | dependencies: [ 7 | .Package(url: "https://github.com/hryk224/CrossNavigationController", majorVersion: 0), 8 | ] 9 | ) 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CrossNavigationcontroller 2 | 3 | Move to cross using `UINavigationController` 4 | 5 | [![CocoaPods Compatible](http://img.shields.io/cocoapods/v/CrossNavigationController.svg?style=flat)](http://cocoadocs.org/docsets/CrossNavigationcontroller) 6 | [![Swift 3.0](https://img.shields.io/badge/Swift-3.0-orange.svg?style=flat)](https://developer.apple.com/swift/) 7 | 8 | 9 | 10 | 11 | 12 | ## Requirements 13 | - iOS 9.0+ 14 | - Swift 3.0+ 15 | - ARC 16 | 17 | ## install 18 | 19 | #### CocoaPods 20 | 21 | Adding the following to your `Podfile` and running `pod install`: 22 | 23 | ```Ruby 24 | use_frameworks! 25 | pod "CrossNavigationcontroller" 26 | ``` 27 | 28 | ### import 29 | 30 | ```Swift 31 | import CrossNavigationcontroller 32 | ``` 33 | 34 | ## Usage 35 | 36 | * Change `UINavigationController` to `CrossNavigationcontroller` 37 | * Change `UIViewController` to `CrossViewController` 38 | * If want to use Gesture, set `CrossGestureControllable` protocol at CrossViewController subclass 39 | 40 | ### Move (push, pop) 41 | 42 | ```Swift 43 | func moveViewController(_ viewController: CrossViewController, direction : Cross.Direction, animated: Bool) 44 | ``` 45 | 46 | `Cross.Direction` => `.up` or `.down` or `.left` or `right` 47 | 48 | ### Move to root 49 | 50 | ```Swift 51 | // UINavigationController method 52 | func moveToRootViewController(animated: Bool) -> [UIViewController]? 53 | ``` 54 | 55 | ## Customize 56 | 57 | #### If change the start coordinates 58 | 59 | In `CrossNavigationcontroller` 60 | 61 | ```Swift 62 | override func viewDidLoad() { 63 | super.viewDidLoad() 64 | setUp(initialCoordinate: (X, Y)) 65 | } 66 | ``` 67 | 68 | #### If use custom transition 69 | 70 | In `CrossNavigationcontroller` 71 | 72 | ```Swift 73 | override func navigationController(_ navigationController: UINavigationController, animationControllerFor operation: UINavigationControllerOperation, from fromVC: UIViewController, to toVC: UIViewController) -> UIViewControllerAnimatedTransitioning? { 74 | return CustomTransionAnimator() 75 | } 76 | ``` 77 | 78 | ## License 79 | 80 | This project is made available under the MIT license. See LICENSE file for details. 81 | -------------------------------------------------------------------------------- /Sources/Cross+Animator.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CrossTransitionAnimator.swift 3 | // CrossNavigationController 4 | // 5 | // Created by yoshida hiroyuki on 2016/11/04. 6 | // Copyright © 2016年 hryk224. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import Foundation 11 | 12 | extension Cross { 13 | final class Animator: NSObject { 14 | public typealias Coordinate = Cross.Coordinate 15 | var operation: UINavigationControllerOperation = .none 16 | } 17 | } 18 | 19 | // MARK: - UIViewControllerAnimatedTransitioning 20 | extension Cross.Animator: UIViewControllerAnimatedTransitioning { 21 | func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval { 22 | return 0.5 23 | } 24 | func animateTransition(using transitionContext: UIViewControllerContextTransitioning) { 25 | switch operation { 26 | case .push, .pop: 27 | animation(using: transitionContext) 28 | case .none: 29 | return 30 | } 31 | } 32 | } 33 | 34 | // MARK: - Move 35 | private extension Cross.Animator { 36 | func animation(using transitionContext: UIViewControllerContextTransitioning) { 37 | let cancelled = transitionContext.transitionWasCancelled 38 | guard let fromVC = transitionContext.viewController(forKey: .from) as? CrossViewController, 39 | let toVC = transitionContext.viewController(forKey: .to) as? CrossViewController, 40 | let fromView = fromVC.view, 41 | let toView = toVC.view else { 42 | transitionContext.completeTransition(!cancelled) 43 | return 44 | } 45 | let containerView = transitionContext.containerView 46 | containerView.backgroundColor = fromView.backgroundColor ?? toView.backgroundColor ?? .clear 47 | fromView.frame = containerView.bounds 48 | toView.frame = containerView.bounds 49 | containerView.addSubview(fromView) 50 | containerView.addSubview(toView) 51 | let coordinate: Cross.Coordinate = fromVC.differenceCoordinate(toVC: toVC) 52 | let diff: (x: CGFloat, y: CGFloat) = (CGFloat(coordinate.x), CGFloat(coordinate.y)) 53 | typealias Transfrom3d = (tx: CGFloat, ty: CGFloat, tz: CGFloat) 54 | let toViewTransfrom3d: Transfrom3d = (containerView.frame.width * diff.x, -containerView.frame.height * diff.y, 0) 55 | let fromViewTransfrom3d: Transfrom3d = (-containerView.frame.width * diff.x, containerView.frame.height * diff.y, 0) 56 | toView.layer.transform = CATransform3DMakeTranslation(toViewTransfrom3d.tx, toViewTransfrom3d.ty, toViewTransfrom3d.tz) 57 | fromView.layer.transform = CATransform3DIdentity 58 | let animations = { 59 | toView.layer.transform = CATransform3DIdentity 60 | fromView.layer.transform = CATransform3DMakeTranslation(fromViewTransfrom3d.tx, fromViewTransfrom3d.ty, fromViewTransfrom3d.tz) 61 | } 62 | UIView.animate(withDuration: transitionDuration(using: transitionContext), delay: 0, options: .curveLinear, animations: animations) { [weak self] finished in 63 | guard finished else { return } 64 | self?.animationCompletion(using: transitionContext, toView: toView, fromView: fromView) 65 | } 66 | } 67 | func animationCompletion(using transitionContext: UIViewControllerContextTransitioning, toView: UIView, fromView: UIView) { 68 | let cancelled = transitionContext.transitionWasCancelled 69 | if cancelled { 70 | toView.removeFromSuperview() 71 | } else { 72 | fromView.removeFromSuperview() 73 | } 74 | toView.layer.transform = CATransform3DIdentity 75 | fromView.layer.transform = CATransform3DIdentity 76 | transitionContext.completeTransition(!cancelled) 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /Sources/Cross.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Cross.swift 3 | // CrossNavigationController 4 | // 5 | // Created by yoshida hiroyuki on 2016/11/04. 6 | // Copyright © 2016年 hryk224. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public struct Cross { 12 | public enum Direction { 13 | case up, right, down, left 14 | } 15 | public typealias Coordinate = (x: Int, y: Int) 16 | } 17 | -------------------------------------------------------------------------------- /Sources/CrossControllable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CrossControllerable.swift 3 | // CrossNavigationController 4 | // 5 | // Created by yoshida hiroyuki on 2016/11/08. 6 | // Copyright © 2016年 hryk224. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | public protocol CrossControllable: class { 12 | var view: UIView! { set get } 13 | var navigationController: UINavigationController? { get } 14 | var crossNavigationController: CrossNavigationController? { get } 15 | var coordinate: Cross.Coordinate { get } 16 | } 17 | 18 | extension CrossControllable { 19 | var crossNavigationController: CrossNavigationController? { 20 | return navigationController as? CrossNavigationController 21 | } 22 | } 23 | 24 | public protocol CrossGestureControllable: CrossControllable { 25 | 26 | var upViewContoller: CrossViewController? { get set } 27 | var rightViewContoller: CrossViewController? { get set } 28 | var downViewContoller: CrossViewController? { get set } 29 | var leftViewContoller: CrossViewController? { get set } 30 | func move(_ direction: Cross.Direction) 31 | 32 | func addGestureRecognizer(_ direction: Cross.Direction) 33 | func removeGestureRecognizer(_ direction: Cross.Direction) 34 | func removeAllGestureRecognizers() 35 | } 36 | 37 | // MARK: - Extension 38 | public extension CrossGestureControllable { 39 | func move(_ direction: Cross.Direction) { 40 | let crossViewController: CrossViewController? 41 | switch direction { 42 | case .up: 43 | crossViewController = upViewContoller 44 | case .right: 45 | crossViewController = rightViewContoller 46 | case .down: 47 | crossViewController = downViewContoller 48 | case .left: 49 | crossViewController = leftViewContoller 50 | } 51 | guard let viewController = crossViewController else { return } 52 | crossNavigationController?.moveViewController(viewController, direction: direction, animated: true) 53 | } 54 | } 55 | 56 | // MARK: - Extension 57 | public extension CrossGestureControllable { 58 | func addGestureRecognizer(_ direction: Cross.Direction) { 59 | guard let crossNavigationController = crossNavigationController else { return } 60 | guard navigationController?.view.gestureRecognizers?.filter({ ($0 as? CrossPanGestureRecognizer)?.direction == direction }).isEmpty == true else { return } 61 | let panGesture = CrossPanGestureRecognizer() 62 | panGesture.addTarget(crossNavigationController, action: #selector(CrossNavigationController.handlePanGesture(_:))) 63 | panGesture.direction = direction 64 | navigationController?.view.addGestureRecognizer(panGesture) 65 | } 66 | func removeGestureRecognizer(_ direction: Cross.Direction) { 67 | navigationController?.view.gestureRecognizers?.filter({ ($0 as? CrossPanGestureRecognizer)?.direction == direction }).forEach { view.removeGestureRecognizer($0) } 68 | } 69 | func removeAllGestureRecognizers() { 70 | navigationController?.view.gestureRecognizers?.forEach { view.removeGestureRecognizer($0) } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /Sources/CrossNavigationController.h: -------------------------------------------------------------------------------- 1 | // 2 | // CrossNavigationController.h 3 | // CrossNavigationController 4 | // 5 | // Created by yoshida hiroyuki on 2016/11/04. 6 | // Copyright © 2016年 hryk224. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for CrossNavigationController. 12 | FOUNDATION_EXPORT double CrossNavigationControllerVersionNumber; 13 | 14 | //! Project version string for CrossNavigationController. 15 | FOUNDATION_EXPORT const unsigned char CrossNavigationControllerVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | -------------------------------------------------------------------------------- /Sources/CrossNavigationController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CrossNavigationController.swift 3 | // CrossNavigationController 4 | // 5 | // Created by yoshida hiroyuki on 2016/11/04. 6 | // Copyright © 2016年 hryk224. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | open class CrossNavigationController: UINavigationController { 12 | 13 | fileprivate typealias Coordinate = Cross.Coordinate 14 | 15 | fileprivate let animator = Cross.Animator() 16 | fileprivate var interactiveTransition: UIPercentDrivenInteractiveTransition? 17 | 18 | fileprivate var initialCoordinate: Cross.Coordinate = (0, 0) 19 | 20 | // Life cycle 21 | open override func viewDidLoad() { 22 | super.viewDidLoad() 23 | configure() 24 | } 25 | open override func viewWillAppear(_ animated: Bool) { 26 | super.viewWillAppear(animated) 27 | delegate = self 28 | } 29 | open override func viewDidDisappear(_ animated: Bool) { 30 | super.viewDidDisappear(animated) 31 | delegate = nil 32 | } 33 | 34 | // Gesture 35 | dynamic func handlePanGesture(_ gestureRecognizer: CrossPanGestureRecognizer) { 36 | 37 | guard let gestureView = gestureRecognizer.view, let direction = gestureRecognizer.direction, let topViewController = topViewController as? CrossGestureControllable else { return } 38 | 39 | let nextViewController: CrossViewController? 40 | switch direction { 41 | case .up: 42 | nextViewController = topViewController.upViewContoller 43 | case .down: 44 | nextViewController = topViewController.downViewContoller 45 | case .right: 46 | nextViewController = topViewController.rightViewContoller 47 | case .left: 48 | nextViewController = topViewController.leftViewContoller 49 | } 50 | 51 | guard let viewController = nextViewController else { return } 52 | 53 | switch gestureRecognizer.state { 54 | case .began: 55 | interactiveTransition = UIPercentDrivenInteractiveTransition() 56 | interactiveTransition?.completionCurve = .easeOut 57 | moveViewController(viewController, direction: direction, animated: true) 58 | case .changed: 59 | var percent: CGFloat = 0 60 | switch direction { 61 | case .up, .down: 62 | percent = gestureRecognizer.translation(in: gestureView).y / gestureView.bounds.height 63 | case .right, .left: 64 | percent = gestureRecognizer.translation(in: gestureView).x / gestureView.bounds.width 65 | } 66 | percent = min(1, max(0, fabs(percent))) 67 | interactiveTransition?.update(percent) 68 | case .ended, .cancelled: 69 | let velocity: CGFloat 70 | switch direction { 71 | case .up, .down: 72 | velocity = gestureRecognizer.velocity(in: view).y 73 | case .right, .left: 74 | velocity = gestureRecognizer.velocity(in: view).x 75 | } 76 | if fabs(velocity) > 0 { 77 | interactiveTransition?.finish() 78 | } else { 79 | interactiveTransition?.cancel() 80 | } 81 | interactiveTransition = nil 82 | default: 83 | break 84 | } 85 | 86 | } 87 | } 88 | 89 | // MARK: - Extension Coordinate 90 | extension CrossNavigationController { 91 | fileprivate var coordinates: [Coordinate] { 92 | return viewControllers.flatMap({ ($0 as? CrossViewController)?.coordinate }) 93 | } 94 | fileprivate var latestCoordinate: Coordinate { 95 | return coordinates.last ?? initialCoordinate 96 | } 97 | private var popCoordinate: Coordinate { 98 | return coordinates[safe: coordinates.count - 2] ?? initialCoordinate 99 | } 100 | fileprivate var popIndex: Array.Index? { 101 | return index(of: popCoordinate) 102 | } 103 | fileprivate func index(of coordinate: Coordinate) -> Array.Index? { 104 | return coordinates.index{ $0 == coordinate } 105 | } 106 | } 107 | 108 | // MARK: - Extension 109 | extension CrossNavigationController { 110 | // Required setup 111 | fileprivate func configure() {} 112 | open func setUp(initialCoordinate: Cross.Coordinate) { 113 | self.initialCoordinate = initialCoordinate 114 | (topViewController as? CrossViewController)?.position = initialCoordinate 115 | } 116 | open func moveViewController(_ viewController: CrossViewController, direction : Cross.Direction, animated: Bool) { 117 | var newCoordinate = latestCoordinate 118 | switch direction { 119 | case .up: 120 | newCoordinate.y += 1 121 | case .down: 122 | newCoordinate.y -= 1 123 | case .right: 124 | newCoordinate.x += 1 125 | case .left: 126 | newCoordinate.x -= 1 127 | } 128 | if let index = self.index(of: newCoordinate) { 129 | _ = moveToViewController(viewControllers[index], animated: animated) 130 | } else { 131 | viewController.position = newCoordinate 132 | super.pushViewController(viewController, animated: animated) 133 | } 134 | } 135 | open func moveToRootViewController(animated: Bool) -> [UIViewController]? { 136 | return super.popToRootViewController(animated: animated) 137 | } 138 | open func moveToViewController(_ viewController: UIViewController, animated: Bool) -> [UIViewController]? { 139 | return super.popToViewController(viewController, animated: animated) 140 | } 141 | } 142 | 143 | // MARK: - Push / Pop 144 | extension CrossNavigationController { 145 | open override func pushViewController(_ viewController: UIViewController, animated: Bool) { 146 | guard let viewController = viewController as? CrossViewController else { 147 | fatalError("Can not be used this class. Need to use the inherits from CrossViewController") 148 | } 149 | if viewControllers.isEmpty { 150 | super.pushViewController(viewController, animated: animated) 151 | return 152 | } 153 | // FIXME: ... crash 154 | // moveViewController(viewController, direction: direction, animated: animated) 155 | } 156 | open override func popToRootViewController(animated: Bool) -> [UIViewController]? { 157 | return moveToRootViewController(animated: animated) 158 | } 159 | open override func popViewController(animated: Bool) -> UIViewController? { 160 | guard let index = popIndex else { 161 | return nil 162 | } 163 | _ = moveToViewController(viewControllers[index], animated: animated) 164 | return nil 165 | } 166 | open override func popToViewController(_ viewController: UIViewController, animated: Bool) -> [UIViewController]? { 167 | return moveToViewController(viewController, animated: animated) 168 | } 169 | } 170 | 171 | // MARK: - UINavigationcontrollerDelegate 172 | extension CrossNavigationController: UINavigationControllerDelegate { 173 | public func navigationController(_ navigationController: UINavigationController, interactionControllerFor animationController: UIViewControllerAnimatedTransitioning) -> UIViewControllerInteractiveTransitioning? { 174 | return interactiveTransition 175 | } 176 | open func navigationController(_ navigationController: UINavigationController, animationControllerFor operation: UINavigationControllerOperation, from fromVC: UIViewController, to toVC: UIViewController) -> UIViewControllerAnimatedTransitioning? { 177 | guard let _ = fromVC as? CrossViewController, let _ = toVC as? CrossViewController else { 178 | return nil 179 | } 180 | animator.operation = operation 181 | return animator 182 | } 183 | } 184 | 185 | // MARK: - Private Extension 186 | private extension Collection { 187 | subscript(safe index: Index) -> _Element? { 188 | return index >= startIndex && index < endIndex ? self[index] : nil 189 | } 190 | } 191 | -------------------------------------------------------------------------------- /Sources/CrossPanGestureRecognizer.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CrossPanGestureRecognizer.swift 3 | // CrossNavigationController 4 | // 5 | // Created by yoshida hiroyuki on 2016/11/08. 6 | // Copyright © 2016年 hryk224. All rights reserved. 7 | // 8 | 9 | import UIKit.UIGestureRecognizerSubclass 10 | 11 | final class CrossPanGestureRecognizer: UIPanGestureRecognizer { 12 | var direction: Cross.Direction? 13 | private var isMoved: Bool = false 14 | override func touchesMoved(_ touches: Set, with event: UIEvent) { 15 | super.touchesMoved(touches, with: event) 16 | guard !state.isFailed else { return } 17 | let velocityInView = self.velocity(in: view) 18 | if !isMoved && !velocityInView.equalTo(.zero) && Cross.Direction.panDirection(velocityInView) != direction { 19 | state = .failed 20 | } 21 | isMoved = true 22 | } 23 | override func reset() { 24 | super.reset() 25 | isMoved = false 26 | } 27 | } 28 | 29 | // MARK: - Extension 30 | private extension Cross.Direction { 31 | static func panDirection(_ velocity: CGPoint) -> Cross.Direction? { 32 | let velocities: [Cross.Direction: CGFloat] = [ 33 | .right: -velocity.x, 34 | .down: -velocity.y, 35 | .left: velocity.x, 36 | .up: velocity.y 37 | ] 38 | return velocities.sorted { $0.1 < $1.1 }.last?.0 39 | } 40 | } 41 | 42 | // MARK: - Extension 43 | private extension UIGestureRecognizerState { 44 | var isFailed: Bool { 45 | return self == .failed 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Sources/CrossViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CrossViewController.swift 3 | // CrossNavigationController 4 | // 5 | // Created by yoshida hiroyuki on 2016/11/04. 6 | // Copyright © 2016年 hryk224. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | open class CrossViewController: UIViewController, CrossControllable { 12 | open var crossNavigationController: CrossNavigationController? { 13 | return navigationController as? CrossNavigationController 14 | } 15 | open var coordinate: Cross.Coordinate { 16 | return position 17 | } 18 | var position: Cross.Coordinate = (0, 0) 19 | } 20 | 21 | // MARK: - Extension 22 | extension CrossViewController { 23 | func direction(toVC: CrossViewController) -> Cross.Direction { 24 | let coordinate = differenceCoordinate(toVC: toVC) 25 | switch coordinate { 26 | case (_, 0): 27 | return coordinate.x > 0 ? Cross.Direction.left : Cross.Direction.right 28 | case (0, _): 29 | return coordinate.y > 0 ? Cross.Direction.up : Cross.Direction.down 30 | default: 31 | return .right 32 | } 33 | } 34 | func direction(fromVC: CrossViewController) -> Cross.Direction { 35 | return fromVC.direction(toVC: self) 36 | } 37 | open func differenceCoordinate(toVC: CrossViewController) -> Cross.Coordinate { 38 | return (x: toVC.coordinate.x - coordinate.x, y: toVC.coordinate.y - coordinate.y) 39 | } 40 | open func differenceCoordinate(fromVC: CrossViewController) -> Cross.Coordinate { 41 | return fromVC.differenceCoordinate(toVC: self) 42 | } 43 | } 44 | --------------------------------------------------------------------------------