├── .gitignore ├── LICENSE ├── README.md ├── SlideMenu.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcshareddata │ └── xcschemes │ └── SlideMenu.xcscheme ├── SlideMenu ├── Info.plist ├── SlideMenu.h ├── SlideMenuAnimatedTransition.swift └── SlideMenuController.swift ├── SlideMenuDemo ├── AppDelegate.swift ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist ├── LeftViewController.swift ├── MainViewController.swift ├── RightViewController.swift └── UIViewController+SlideMenu.swift ├── SlideMenuTests ├── Info.plist └── SlideMenuTests.swift └── screenshot.gif /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by https://www.gitignore.io/api/osx,xcode,swift 2 | 3 | ### OSX ### 4 | .DS_Store 5 | .AppleDouble 6 | .LSOverride 7 | 8 | # Icon must end with two \r 9 | Icon 10 | 11 | # Thumbnails 12 | ._* 13 | 14 | # Files that might appear in the root of a volume 15 | .DocumentRevisions-V100 16 | .fseventsd 17 | .Spotlight-V100 18 | .TemporaryItems 19 | .Trashes 20 | .VolumeIcon.icns 21 | 22 | # Directories potentially created on remote AFP share 23 | .AppleDB 24 | .AppleDesktop 25 | Network Trash Folder 26 | Temporary Items 27 | .apdisk 28 | 29 | 30 | ### Xcode ### 31 | # Xcode 32 | # 33 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 34 | 35 | ## Build generated 36 | build/ 37 | DerivedData 38 | 39 | ## Various settings 40 | *.pbxuser 41 | !default.pbxuser 42 | *.mode1v3 43 | !default.mode1v3 44 | *.mode2v3 45 | !default.mode2v3 46 | *.perspectivev3 47 | !default.perspectivev3 48 | xcuserdata 49 | 50 | ## Other 51 | *.xccheckout 52 | *.moved-aside 53 | *.xcuserstate 54 | 55 | 56 | ### Swift ### 57 | # Xcode 58 | # 59 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 60 | 61 | ## Build generated 62 | build/ 63 | DerivedData 64 | 65 | ## Various settings 66 | *.pbxuser 67 | !default.pbxuser 68 | *.mode1v3 69 | !default.mode1v3 70 | *.mode2v3 71 | !default.mode2v3 72 | *.perspectivev3 73 | !default.perspectivev3 74 | xcuserdata 75 | 76 | ## Other 77 | *.xccheckout 78 | *.moved-aside 79 | *.xcuserstate 80 | *.xcscmblueprint 81 | 82 | ## Obj-C/Swift specific 83 | *.hmap 84 | *.ipa 85 | 86 | # CocoaPods 87 | # 88 | # We recommend against adding the Pods directory to your .gitignore. However 89 | # you should judge for yourself, the pros and cons are mentioned at: 90 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 91 | # 92 | # Pods/ 93 | 94 | # Carthage 95 | # 96 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 97 | # Carthage/Checkouts 98 | 99 | Carthage/Build 100 | 101 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Katsuma Tanaka 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 | # SlideMenu 2 | 3 | View controller container which provides the sliding menus. 4 | 5 | ![](screenshot.gif) 6 | 7 | 8 | ## Requirements 9 | 10 | - iOS 8.0 or later 11 | 12 | 13 | ## Installation 14 | 15 | Use [Carthage](https://github.com/Carthage/Carthage) 16 | 17 | 18 | ## Usage 19 | 20 | let slideMenuController = SlideMenuController( 21 | mainViewController: ..., 22 | leftViewController: ..., 23 | rightViewController: ... 24 | ) 25 | 26 | window?.rootViewController = slideMenuController 27 | 28 | 29 | ## License 30 | 31 | SlideMenu is released under the MIT license. 32 | For more information, see LICENSE file in this repository. 33 | -------------------------------------------------------------------------------- /SlideMenu.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | AA3729161BC114750098D18F /* SlideMenu.h in Headers */ = {isa = PBXBuildFile; fileRef = AA3729151BC114750098D18F /* SlideMenu.h */; settings = {ATTRIBUTES = (Public, ); }; }; 11 | AA37291D1BC114750098D18F /* SlideMenu.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AA3729131BC114750098D18F /* SlideMenu.framework */; settings = {ASSET_TAGS = (); }; }; 12 | AA3729221BC114750098D18F /* SlideMenuTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA3729211BC114750098D18F /* SlideMenuTests.swift */; }; 13 | AA3729311BC114830098D18F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA3729301BC114830098D18F /* AppDelegate.swift */; }; 14 | AA3729361BC114830098D18F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AA3729341BC114830098D18F /* Main.storyboard */; }; 15 | AA3729381BC114830098D18F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = AA3729371BC114830098D18F /* Assets.xcassets */; }; 16 | AA37293B1BC114830098D18F /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AA3729391BC114830098D18F /* LaunchScreen.storyboard */; }; 17 | AA3A66721BC115A4009C6392 /* SlideMenuAnimatedTransition.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA3A666E1BC115A4009C6392 /* SlideMenuAnimatedTransition.swift */; settings = {ASSET_TAGS = (); }; }; 18 | AA3A66741BC115A4009C6392 /* SlideMenuController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA3A66701BC115A4009C6392 /* SlideMenuController.swift */; settings = {ASSET_TAGS = (); }; }; 19 | AA3A667D1BC115FD009C6392 /* LeftViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA3A667A1BC115FD009C6392 /* LeftViewController.swift */; settings = {ASSET_TAGS = (); }; }; 20 | AA3A667E1BC115FD009C6392 /* MainViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA3A667B1BC115FD009C6392 /* MainViewController.swift */; settings = {ASSET_TAGS = (); }; }; 21 | AA3A667F1BC115FD009C6392 /* RightViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA3A667C1BC115FD009C6392 /* RightViewController.swift */; settings = {ASSET_TAGS = (); }; }; 22 | AA3A66811BC11623009C6392 /* SlideMenu.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AA3729131BC114750098D18F /* SlideMenu.framework */; }; 23 | AA3A66821BC11623009C6392 /* SlideMenu.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = AA3729131BC114750098D18F /* SlideMenu.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 24 | AAE5A5DF1BC6212B008D3DCB /* UIViewController+SlideMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAE5A5DE1BC6212B008D3DCB /* UIViewController+SlideMenu.swift */; settings = {ASSET_TAGS = (); }; }; 25 | /* End PBXBuildFile section */ 26 | 27 | /* Begin PBXContainerItemProxy section */ 28 | AA37291E1BC114750098D18F /* PBXContainerItemProxy */ = { 29 | isa = PBXContainerItemProxy; 30 | containerPortal = AA6340221BBEDA0F00005647 /* Project object */; 31 | proxyType = 1; 32 | remoteGlobalIDString = AA3729121BC114750098D18F; 33 | remoteInfo = SlideMenu; 34 | }; 35 | AA3A66831BC11623009C6392 /* PBXContainerItemProxy */ = { 36 | isa = PBXContainerItemProxy; 37 | containerPortal = AA6340221BBEDA0F00005647 /* Project object */; 38 | proxyType = 1; 39 | remoteGlobalIDString = AA3729121BC114750098D18F; 40 | remoteInfo = SlideMenu; 41 | }; 42 | /* End PBXContainerItemProxy section */ 43 | 44 | /* Begin PBXCopyFilesBuildPhase section */ 45 | AA3A66851BC11624009C6392 /* Embed Frameworks */ = { 46 | isa = PBXCopyFilesBuildPhase; 47 | buildActionMask = 2147483647; 48 | dstPath = ""; 49 | dstSubfolderSpec = 10; 50 | files = ( 51 | AA3A66821BC11623009C6392 /* SlideMenu.framework in Embed Frameworks */, 52 | ); 53 | name = "Embed Frameworks"; 54 | runOnlyForDeploymentPostprocessing = 0; 55 | }; 56 | /* End PBXCopyFilesBuildPhase section */ 57 | 58 | /* Begin PBXFileReference section */ 59 | AA3729131BC114750098D18F /* SlideMenu.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SlideMenu.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 60 | AA3729151BC114750098D18F /* SlideMenu.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SlideMenu.h; sourceTree = ""; }; 61 | AA3729171BC114750098D18F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 62 | AA37291C1BC114750098D18F /* SlideMenuTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SlideMenuTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 63 | AA3729211BC114750098D18F /* SlideMenuTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SlideMenuTests.swift; sourceTree = ""; }; 64 | AA3729231BC114750098D18F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 65 | AA37292E1BC114830098D18F /* SlideMenuDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SlideMenuDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 66 | AA3729301BC114830098D18F /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 67 | AA3729351BC114830098D18F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 68 | AA3729371BC114830098D18F /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 69 | AA37293A1BC114830098D18F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 70 | AA37293C1BC114830098D18F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 71 | AA3A666E1BC115A4009C6392 /* SlideMenuAnimatedTransition.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SlideMenuAnimatedTransition.swift; sourceTree = ""; }; 72 | AA3A66701BC115A4009C6392 /* SlideMenuController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SlideMenuController.swift; sourceTree = ""; }; 73 | AA3A667A1BC115FD009C6392 /* LeftViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LeftViewController.swift; sourceTree = ""; }; 74 | AA3A667B1BC115FD009C6392 /* MainViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MainViewController.swift; sourceTree = ""; }; 75 | AA3A667C1BC115FD009C6392 /* RightViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RightViewController.swift; sourceTree = ""; }; 76 | AAE5A5DE1BC6212B008D3DCB /* UIViewController+SlideMenu.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIViewController+SlideMenu.swift"; sourceTree = ""; }; 77 | /* End PBXFileReference section */ 78 | 79 | /* Begin PBXFrameworksBuildPhase section */ 80 | AA37290F1BC114750098D18F /* Frameworks */ = { 81 | isa = PBXFrameworksBuildPhase; 82 | buildActionMask = 2147483647; 83 | files = ( 84 | ); 85 | runOnlyForDeploymentPostprocessing = 0; 86 | }; 87 | AA3729191BC114750098D18F /* Frameworks */ = { 88 | isa = PBXFrameworksBuildPhase; 89 | buildActionMask = 2147483647; 90 | files = ( 91 | AA37291D1BC114750098D18F /* SlideMenu.framework in Frameworks */, 92 | ); 93 | runOnlyForDeploymentPostprocessing = 0; 94 | }; 95 | AA37292B1BC114830098D18F /* Frameworks */ = { 96 | isa = PBXFrameworksBuildPhase; 97 | buildActionMask = 2147483647; 98 | files = ( 99 | AA3A66811BC11623009C6392 /* SlideMenu.framework in Frameworks */, 100 | ); 101 | runOnlyForDeploymentPostprocessing = 0; 102 | }; 103 | /* End PBXFrameworksBuildPhase section */ 104 | 105 | /* Begin PBXGroup section */ 106 | AA3729141BC114750098D18F /* SlideMenu */ = { 107 | isa = PBXGroup; 108 | children = ( 109 | AA3729151BC114750098D18F /* SlideMenu.h */, 110 | AA3A66791BC115C3009C6392 /* Common */, 111 | AA3A66771BC115B4009C6392 /* ViewControllers */, 112 | AA3A666B1BC1156F009C6392 /* Supporting Files */, 113 | ); 114 | path = SlideMenu; 115 | sourceTree = ""; 116 | }; 117 | AA3729201BC114750098D18F /* SlideMenuTests */ = { 118 | isa = PBXGroup; 119 | children = ( 120 | AA3729211BC114750098D18F /* SlideMenuTests.swift */, 121 | AAA4E7EC1BCD6ADA005906F3 /* Supporting Files */, 122 | ); 123 | path = SlideMenuTests; 124 | sourceTree = ""; 125 | }; 126 | AA37292F1BC114830098D18F /* SlideMenuDemo */ = { 127 | isa = PBXGroup; 128 | children = ( 129 | AAE5A5E01BC62138008D3DCB /* Extensions */, 130 | AA3A66801BC11600009C6392 /* ViewControllers */, 131 | AA3729301BC114830098D18F /* AppDelegate.swift */, 132 | AA3A666C1BC11578009C6392 /* Resources */, 133 | AA3A666D1BC11587009C6392 /* Supporting Files */, 134 | ); 135 | path = SlideMenuDemo; 136 | sourceTree = ""; 137 | }; 138 | AA3A666B1BC1156F009C6392 /* Supporting Files */ = { 139 | isa = PBXGroup; 140 | children = ( 141 | AA3729171BC114750098D18F /* Info.plist */, 142 | ); 143 | name = "Supporting Files"; 144 | sourceTree = ""; 145 | }; 146 | AA3A666C1BC11578009C6392 /* Resources */ = { 147 | isa = PBXGroup; 148 | children = ( 149 | AA3729341BC114830098D18F /* Main.storyboard */, 150 | AA3729371BC114830098D18F /* Assets.xcassets */, 151 | AA3729391BC114830098D18F /* LaunchScreen.storyboard */, 152 | ); 153 | name = Resources; 154 | sourceTree = ""; 155 | }; 156 | AA3A666D1BC11587009C6392 /* Supporting Files */ = { 157 | isa = PBXGroup; 158 | children = ( 159 | AA37293C1BC114830098D18F /* Info.plist */, 160 | ); 161 | name = "Supporting Files"; 162 | sourceTree = ""; 163 | }; 164 | AA3A66771BC115B4009C6392 /* ViewControllers */ = { 165 | isa = PBXGroup; 166 | children = ( 167 | AA3A66701BC115A4009C6392 /* SlideMenuController.swift */, 168 | ); 169 | name = ViewControllers; 170 | sourceTree = ""; 171 | }; 172 | AA3A66791BC115C3009C6392 /* Common */ = { 173 | isa = PBXGroup; 174 | children = ( 175 | AA3A666E1BC115A4009C6392 /* SlideMenuAnimatedTransition.swift */, 176 | ); 177 | name = Common; 178 | sourceTree = ""; 179 | }; 180 | AA3A66801BC11600009C6392 /* ViewControllers */ = { 181 | isa = PBXGroup; 182 | children = ( 183 | AA3A667B1BC115FD009C6392 /* MainViewController.swift */, 184 | AA3A667A1BC115FD009C6392 /* LeftViewController.swift */, 185 | AA3A667C1BC115FD009C6392 /* RightViewController.swift */, 186 | ); 187 | name = ViewControllers; 188 | sourceTree = ""; 189 | }; 190 | AA6340211BBEDA0F00005647 = { 191 | isa = PBXGroup; 192 | children = ( 193 | AA3729141BC114750098D18F /* SlideMenu */, 194 | AA3729201BC114750098D18F /* SlideMenuTests */, 195 | AA37292F1BC114830098D18F /* SlideMenuDemo */, 196 | AA63402B1BBEDA0F00005647 /* Products */, 197 | ); 198 | sourceTree = ""; 199 | }; 200 | AA63402B1BBEDA0F00005647 /* Products */ = { 201 | isa = PBXGroup; 202 | children = ( 203 | AA3729131BC114750098D18F /* SlideMenu.framework */, 204 | AA37291C1BC114750098D18F /* SlideMenuTests.xctest */, 205 | AA37292E1BC114830098D18F /* SlideMenuDemo.app */, 206 | ); 207 | name = Products; 208 | sourceTree = ""; 209 | }; 210 | AAA4E7EC1BCD6ADA005906F3 /* Supporting Files */ = { 211 | isa = PBXGroup; 212 | children = ( 213 | AA3729231BC114750098D18F /* Info.plist */, 214 | ); 215 | name = "Supporting Files"; 216 | sourceTree = ""; 217 | }; 218 | AAE5A5E01BC62138008D3DCB /* Extensions */ = { 219 | isa = PBXGroup; 220 | children = ( 221 | AAE5A5DE1BC6212B008D3DCB /* UIViewController+SlideMenu.swift */, 222 | ); 223 | name = Extensions; 224 | sourceTree = ""; 225 | }; 226 | /* End PBXGroup section */ 227 | 228 | /* Begin PBXHeadersBuildPhase section */ 229 | AA3729101BC114750098D18F /* Headers */ = { 230 | isa = PBXHeadersBuildPhase; 231 | buildActionMask = 2147483647; 232 | files = ( 233 | AA3729161BC114750098D18F /* SlideMenu.h in Headers */, 234 | ); 235 | runOnlyForDeploymentPostprocessing = 0; 236 | }; 237 | /* End PBXHeadersBuildPhase section */ 238 | 239 | /* Begin PBXNativeTarget section */ 240 | AA3729121BC114750098D18F /* SlideMenu */ = { 241 | isa = PBXNativeTarget; 242 | buildConfigurationList = AA3729241BC114750098D18F /* Build configuration list for PBXNativeTarget "SlideMenu" */; 243 | buildPhases = ( 244 | AA37290E1BC114750098D18F /* Sources */, 245 | AA37290F1BC114750098D18F /* Frameworks */, 246 | AA3729101BC114750098D18F /* Headers */, 247 | AA3729111BC114750098D18F /* Resources */, 248 | ); 249 | buildRules = ( 250 | ); 251 | dependencies = ( 252 | ); 253 | name = SlideMenu; 254 | productName = SlideMenu; 255 | productReference = AA3729131BC114750098D18F /* SlideMenu.framework */; 256 | productType = "com.apple.product-type.framework"; 257 | }; 258 | AA37291B1BC114750098D18F /* SlideMenuTests */ = { 259 | isa = PBXNativeTarget; 260 | buildConfigurationList = AA3729271BC114750098D18F /* Build configuration list for PBXNativeTarget "SlideMenuTests" */; 261 | buildPhases = ( 262 | AA3729181BC114750098D18F /* Sources */, 263 | AA3729191BC114750098D18F /* Frameworks */, 264 | AA37291A1BC114750098D18F /* Resources */, 265 | ); 266 | buildRules = ( 267 | ); 268 | dependencies = ( 269 | AA37291F1BC114750098D18F /* PBXTargetDependency */, 270 | ); 271 | name = SlideMenuTests; 272 | productName = SlideMenuTests; 273 | productReference = AA37291C1BC114750098D18F /* SlideMenuTests.xctest */; 274 | productType = "com.apple.product-type.bundle.unit-test"; 275 | }; 276 | AA37292D1BC114830098D18F /* SlideMenuDemo */ = { 277 | isa = PBXNativeTarget; 278 | buildConfigurationList = AA37293D1BC114830098D18F /* Build configuration list for PBXNativeTarget "SlideMenuDemo" */; 279 | buildPhases = ( 280 | AA37292A1BC114830098D18F /* Sources */, 281 | AA37292B1BC114830098D18F /* Frameworks */, 282 | AA37292C1BC114830098D18F /* Resources */, 283 | AA3A66851BC11624009C6392 /* Embed Frameworks */, 284 | ); 285 | buildRules = ( 286 | ); 287 | dependencies = ( 288 | AA3A66841BC11623009C6392 /* PBXTargetDependency */, 289 | ); 290 | name = SlideMenuDemo; 291 | productName = SlideMenuDemo; 292 | productReference = AA37292E1BC114830098D18F /* SlideMenuDemo.app */; 293 | productType = "com.apple.product-type.application"; 294 | }; 295 | /* End PBXNativeTarget section */ 296 | 297 | /* Begin PBXProject section */ 298 | AA6340221BBEDA0F00005647 /* Project object */ = { 299 | isa = PBXProject; 300 | attributes = { 301 | LastSwiftUpdateCheck = 0700; 302 | LastUpgradeCheck = 0700; 303 | ORGANIZATIONNAME = "Katsuma Tanaka"; 304 | TargetAttributes = { 305 | AA3729121BC114750098D18F = { 306 | CreatedOnToolsVersion = 7.0.1; 307 | }; 308 | AA37291B1BC114750098D18F = { 309 | CreatedOnToolsVersion = 7.0.1; 310 | }; 311 | AA37292D1BC114830098D18F = { 312 | CreatedOnToolsVersion = 7.0.1; 313 | }; 314 | }; 315 | }; 316 | buildConfigurationList = AA6340251BBEDA0F00005647 /* Build configuration list for PBXProject "SlideMenu" */; 317 | compatibilityVersion = "Xcode 3.2"; 318 | developmentRegion = English; 319 | hasScannedForEncodings = 0; 320 | knownRegions = ( 321 | en, 322 | Base, 323 | ); 324 | mainGroup = AA6340211BBEDA0F00005647; 325 | productRefGroup = AA63402B1BBEDA0F00005647 /* Products */; 326 | projectDirPath = ""; 327 | projectRoot = ""; 328 | targets = ( 329 | AA3729121BC114750098D18F /* SlideMenu */, 330 | AA37291B1BC114750098D18F /* SlideMenuTests */, 331 | AA37292D1BC114830098D18F /* SlideMenuDemo */, 332 | ); 333 | }; 334 | /* End PBXProject section */ 335 | 336 | /* Begin PBXResourcesBuildPhase section */ 337 | AA3729111BC114750098D18F /* Resources */ = { 338 | isa = PBXResourcesBuildPhase; 339 | buildActionMask = 2147483647; 340 | files = ( 341 | ); 342 | runOnlyForDeploymentPostprocessing = 0; 343 | }; 344 | AA37291A1BC114750098D18F /* Resources */ = { 345 | isa = PBXResourcesBuildPhase; 346 | buildActionMask = 2147483647; 347 | files = ( 348 | ); 349 | runOnlyForDeploymentPostprocessing = 0; 350 | }; 351 | AA37292C1BC114830098D18F /* Resources */ = { 352 | isa = PBXResourcesBuildPhase; 353 | buildActionMask = 2147483647; 354 | files = ( 355 | AA37293B1BC114830098D18F /* LaunchScreen.storyboard in Resources */, 356 | AA3729381BC114830098D18F /* Assets.xcassets in Resources */, 357 | AA3729361BC114830098D18F /* Main.storyboard in Resources */, 358 | ); 359 | runOnlyForDeploymentPostprocessing = 0; 360 | }; 361 | /* End PBXResourcesBuildPhase section */ 362 | 363 | /* Begin PBXSourcesBuildPhase section */ 364 | AA37290E1BC114750098D18F /* Sources */ = { 365 | isa = PBXSourcesBuildPhase; 366 | buildActionMask = 2147483647; 367 | files = ( 368 | AA3A66721BC115A4009C6392 /* SlideMenuAnimatedTransition.swift in Sources */, 369 | AA3A66741BC115A4009C6392 /* SlideMenuController.swift in Sources */, 370 | ); 371 | runOnlyForDeploymentPostprocessing = 0; 372 | }; 373 | AA3729181BC114750098D18F /* Sources */ = { 374 | isa = PBXSourcesBuildPhase; 375 | buildActionMask = 2147483647; 376 | files = ( 377 | AA3729221BC114750098D18F /* SlideMenuTests.swift in Sources */, 378 | ); 379 | runOnlyForDeploymentPostprocessing = 0; 380 | }; 381 | AA37292A1BC114830098D18F /* Sources */ = { 382 | isa = PBXSourcesBuildPhase; 383 | buildActionMask = 2147483647; 384 | files = ( 385 | AA3A667E1BC115FD009C6392 /* MainViewController.swift in Sources */, 386 | AA3A667F1BC115FD009C6392 /* RightViewController.swift in Sources */, 387 | AA3729311BC114830098D18F /* AppDelegate.swift in Sources */, 388 | AAE5A5DF1BC6212B008D3DCB /* UIViewController+SlideMenu.swift in Sources */, 389 | AA3A667D1BC115FD009C6392 /* LeftViewController.swift in Sources */, 390 | ); 391 | runOnlyForDeploymentPostprocessing = 0; 392 | }; 393 | /* End PBXSourcesBuildPhase section */ 394 | 395 | /* Begin PBXTargetDependency section */ 396 | AA37291F1BC114750098D18F /* PBXTargetDependency */ = { 397 | isa = PBXTargetDependency; 398 | target = AA3729121BC114750098D18F /* SlideMenu */; 399 | targetProxy = AA37291E1BC114750098D18F /* PBXContainerItemProxy */; 400 | }; 401 | AA3A66841BC11623009C6392 /* PBXTargetDependency */ = { 402 | isa = PBXTargetDependency; 403 | target = AA3729121BC114750098D18F /* SlideMenu */; 404 | targetProxy = AA3A66831BC11623009C6392 /* PBXContainerItemProxy */; 405 | }; 406 | /* End PBXTargetDependency section */ 407 | 408 | /* Begin PBXVariantGroup section */ 409 | AA3729341BC114830098D18F /* Main.storyboard */ = { 410 | isa = PBXVariantGroup; 411 | children = ( 412 | AA3729351BC114830098D18F /* Base */, 413 | ); 414 | name = Main.storyboard; 415 | sourceTree = ""; 416 | }; 417 | AA3729391BC114830098D18F /* LaunchScreen.storyboard */ = { 418 | isa = PBXVariantGroup; 419 | children = ( 420 | AA37293A1BC114830098D18F /* Base */, 421 | ); 422 | name = LaunchScreen.storyboard; 423 | sourceTree = ""; 424 | }; 425 | /* End PBXVariantGroup section */ 426 | 427 | /* Begin XCBuildConfiguration section */ 428 | AA3729251BC114750098D18F /* Debug */ = { 429 | isa = XCBuildConfiguration; 430 | buildSettings = { 431 | APPLICATION_EXTENSION_API_ONLY = YES; 432 | BITCODE_GENERATION_MODE = marker; 433 | CLANG_ENABLE_MODULES = YES; 434 | CURRENT_PROJECT_VERSION = 1; 435 | DEFINES_MODULE = YES; 436 | DYLIB_COMPATIBILITY_VERSION = 1; 437 | DYLIB_CURRENT_VERSION = 1; 438 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 439 | INFOPLIST_FILE = SlideMenu/Info.plist; 440 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 441 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 442 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 443 | PRODUCT_BUNDLE_IDENTIFIER = jp.questbeat.SlideMenu; 444 | PRODUCT_NAME = "$(TARGET_NAME)"; 445 | SKIP_INSTALL = YES; 446 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 447 | VERSIONING_SYSTEM = "apple-generic"; 448 | VERSION_INFO_PREFIX = ""; 449 | }; 450 | name = Debug; 451 | }; 452 | AA3729261BC114750098D18F /* Release */ = { 453 | isa = XCBuildConfiguration; 454 | buildSettings = { 455 | APPLICATION_EXTENSION_API_ONLY = YES; 456 | BITCODE_GENERATION_MODE = bitcode; 457 | CLANG_ENABLE_MODULES = YES; 458 | CURRENT_PROJECT_VERSION = 1; 459 | DEFINES_MODULE = YES; 460 | DYLIB_COMPATIBILITY_VERSION = 1; 461 | DYLIB_CURRENT_VERSION = 1; 462 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 463 | INFOPLIST_FILE = SlideMenu/Info.plist; 464 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 465 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 466 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 467 | PRODUCT_BUNDLE_IDENTIFIER = jp.questbeat.SlideMenu; 468 | PRODUCT_NAME = "$(TARGET_NAME)"; 469 | SKIP_INSTALL = YES; 470 | VERSIONING_SYSTEM = "apple-generic"; 471 | VERSION_INFO_PREFIX = ""; 472 | }; 473 | name = Release; 474 | }; 475 | AA3729281BC114750098D18F /* Debug */ = { 476 | isa = XCBuildConfiguration; 477 | buildSettings = { 478 | INFOPLIST_FILE = SlideMenuTests/Info.plist; 479 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 480 | PRODUCT_BUNDLE_IDENTIFIER = jp.questbeat.SlideMenuTests; 481 | PRODUCT_NAME = "$(TARGET_NAME)"; 482 | }; 483 | name = Debug; 484 | }; 485 | AA3729291BC114750098D18F /* Release */ = { 486 | isa = XCBuildConfiguration; 487 | buildSettings = { 488 | INFOPLIST_FILE = SlideMenuTests/Info.plist; 489 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 490 | PRODUCT_BUNDLE_IDENTIFIER = jp.questbeat.SlideMenuTests; 491 | PRODUCT_NAME = "$(TARGET_NAME)"; 492 | }; 493 | name = Release; 494 | }; 495 | AA37293E1BC114830098D18F /* Debug */ = { 496 | isa = XCBuildConfiguration; 497 | buildSettings = { 498 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 499 | EMBEDDED_CONTENT_CONTAINS_SWIFT = YES; 500 | INFOPLIST_FILE = SlideMenuDemo/Info.plist; 501 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 502 | PRODUCT_BUNDLE_IDENTIFIER = jp.questbeat.SlideMenuDemo; 503 | PRODUCT_NAME = "$(TARGET_NAME)"; 504 | }; 505 | name = Debug; 506 | }; 507 | AA37293F1BC114830098D18F /* Release */ = { 508 | isa = XCBuildConfiguration; 509 | buildSettings = { 510 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 511 | EMBEDDED_CONTENT_CONTAINS_SWIFT = YES; 512 | INFOPLIST_FILE = SlideMenuDemo/Info.plist; 513 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 514 | PRODUCT_BUNDLE_IDENTIFIER = jp.questbeat.SlideMenuDemo; 515 | PRODUCT_NAME = "$(TARGET_NAME)"; 516 | }; 517 | name = Release; 518 | }; 519 | AA6340501BBEDA0F00005647 /* Debug */ = { 520 | isa = XCBuildConfiguration; 521 | buildSettings = { 522 | ALWAYS_SEARCH_USER_PATHS = NO; 523 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 524 | CLANG_CXX_LIBRARY = "libc++"; 525 | CLANG_ENABLE_MODULES = YES; 526 | CLANG_ENABLE_OBJC_ARC = YES; 527 | CLANG_WARN_BOOL_CONVERSION = YES; 528 | CLANG_WARN_CONSTANT_CONVERSION = YES; 529 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 530 | CLANG_WARN_EMPTY_BODY = YES; 531 | CLANG_WARN_ENUM_CONVERSION = YES; 532 | CLANG_WARN_INT_CONVERSION = YES; 533 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 534 | CLANG_WARN_UNREACHABLE_CODE = YES; 535 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 536 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 537 | COPY_PHASE_STRIP = NO; 538 | DEBUG_INFORMATION_FORMAT = dwarf; 539 | ENABLE_STRICT_OBJC_MSGSEND = YES; 540 | ENABLE_TESTABILITY = YES; 541 | GCC_C_LANGUAGE_STANDARD = gnu99; 542 | GCC_DYNAMIC_NO_PIC = NO; 543 | GCC_NO_COMMON_BLOCKS = YES; 544 | GCC_OPTIMIZATION_LEVEL = 0; 545 | GCC_PREPROCESSOR_DEFINITIONS = ( 546 | "DEBUG=1", 547 | "$(inherited)", 548 | ); 549 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 550 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 551 | GCC_WARN_UNDECLARED_SELECTOR = YES; 552 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 553 | GCC_WARN_UNUSED_FUNCTION = YES; 554 | GCC_WARN_UNUSED_VARIABLE = YES; 555 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 556 | MTL_ENABLE_DEBUG_INFO = YES; 557 | ONLY_ACTIVE_ARCH = YES; 558 | SDKROOT = iphoneos; 559 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 560 | TARGETED_DEVICE_FAMILY = "1,2"; 561 | }; 562 | name = Debug; 563 | }; 564 | AA6340511BBEDA0F00005647 /* Release */ = { 565 | isa = XCBuildConfiguration; 566 | buildSettings = { 567 | ALWAYS_SEARCH_USER_PATHS = NO; 568 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 569 | CLANG_CXX_LIBRARY = "libc++"; 570 | CLANG_ENABLE_MODULES = YES; 571 | CLANG_ENABLE_OBJC_ARC = YES; 572 | CLANG_WARN_BOOL_CONVERSION = YES; 573 | CLANG_WARN_CONSTANT_CONVERSION = YES; 574 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 575 | CLANG_WARN_EMPTY_BODY = YES; 576 | CLANG_WARN_ENUM_CONVERSION = YES; 577 | CLANG_WARN_INT_CONVERSION = YES; 578 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 579 | CLANG_WARN_UNREACHABLE_CODE = YES; 580 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 581 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 582 | COPY_PHASE_STRIP = NO; 583 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 584 | ENABLE_NS_ASSERTIONS = NO; 585 | ENABLE_STRICT_OBJC_MSGSEND = YES; 586 | GCC_C_LANGUAGE_STANDARD = gnu99; 587 | GCC_NO_COMMON_BLOCKS = YES; 588 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 589 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 590 | GCC_WARN_UNDECLARED_SELECTOR = YES; 591 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 592 | GCC_WARN_UNUSED_FUNCTION = YES; 593 | GCC_WARN_UNUSED_VARIABLE = YES; 594 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 595 | MTL_ENABLE_DEBUG_INFO = NO; 596 | SDKROOT = iphoneos; 597 | TARGETED_DEVICE_FAMILY = "1,2"; 598 | VALIDATE_PRODUCT = YES; 599 | }; 600 | name = Release; 601 | }; 602 | /* End XCBuildConfiguration section */ 603 | 604 | /* Begin XCConfigurationList section */ 605 | AA3729241BC114750098D18F /* Build configuration list for PBXNativeTarget "SlideMenu" */ = { 606 | isa = XCConfigurationList; 607 | buildConfigurations = ( 608 | AA3729251BC114750098D18F /* Debug */, 609 | AA3729261BC114750098D18F /* Release */, 610 | ); 611 | defaultConfigurationIsVisible = 0; 612 | defaultConfigurationName = Release; 613 | }; 614 | AA3729271BC114750098D18F /* Build configuration list for PBXNativeTarget "SlideMenuTests" */ = { 615 | isa = XCConfigurationList; 616 | buildConfigurations = ( 617 | AA3729281BC114750098D18F /* Debug */, 618 | AA3729291BC114750098D18F /* Release */, 619 | ); 620 | defaultConfigurationIsVisible = 0; 621 | defaultConfigurationName = Release; 622 | }; 623 | AA37293D1BC114830098D18F /* Build configuration list for PBXNativeTarget "SlideMenuDemo" */ = { 624 | isa = XCConfigurationList; 625 | buildConfigurations = ( 626 | AA37293E1BC114830098D18F /* Debug */, 627 | AA37293F1BC114830098D18F /* Release */, 628 | ); 629 | defaultConfigurationIsVisible = 0; 630 | defaultConfigurationName = Release; 631 | }; 632 | AA6340251BBEDA0F00005647 /* Build configuration list for PBXProject "SlideMenu" */ = { 633 | isa = XCConfigurationList; 634 | buildConfigurations = ( 635 | AA6340501BBEDA0F00005647 /* Debug */, 636 | AA6340511BBEDA0F00005647 /* Release */, 637 | ); 638 | defaultConfigurationIsVisible = 0; 639 | defaultConfigurationName = Release; 640 | }; 641 | /* End XCConfigurationList section */ 642 | }; 643 | rootObject = AA6340221BBEDA0F00005647 /* Project object */; 644 | } 645 | -------------------------------------------------------------------------------- /SlideMenu.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SlideMenu.xcodeproj/xcshareddata/xcschemes/SlideMenu.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 43 | 49 | 50 | 51 | 52 | 53 | 59 | 60 | 61 | 62 | 63 | 64 | 74 | 76 | 82 | 83 | 84 | 85 | 86 | 87 | 93 | 95 | 101 | 102 | 103 | 104 | 106 | 107 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /SlideMenu/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 | 2.3.2 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /SlideMenu/SlideMenu.h: -------------------------------------------------------------------------------- 1 | // 2 | // SlideMenu.h 3 | // SlideMenu 4 | // 5 | // Created by Katsuma Tanaka on 2015/10/05. 6 | // Copyright © 2015 Katsuma Tanaka. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for SlideMenu. 12 | FOUNDATION_EXPORT double SlideMenuVersionNumber; 13 | 14 | //! Project version string for SlideMenu. 15 | FOUNDATION_EXPORT const unsigned char SlideMenuVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | -------------------------------------------------------------------------------- /SlideMenu/SlideMenuAnimatedTransition.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SlideMenuAnimatedTransition.swift 3 | // SlideMenu 4 | // 5 | // Created by Katsuma Tanaka on 2015/10/05. 6 | // Copyright © 2015 Katsuma Tanaka. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | protocol SlideMenuAnimatedTransitionDelegate: NSObjectProtocol { 12 | 13 | func slideMenuAnimatedTransition(slideMenuAnimatedTransition: SlideMenuAnimatedTransition, handleTapGesture tapGestureRecognizer: UITapGestureRecognizer) 14 | func slideMenuAnimatedTransition(slideMenuAnimatedTransition: SlideMenuAnimatedTransition, handlePanGesture panGestureRecognizer: UIPanGestureRecognizer) 15 | 16 | } 17 | 18 | public class SlideMenuAnimatedTransition: NSObject, UIViewControllerAnimatedTransitioning { 19 | 20 | // MARK: - Properties 21 | 22 | enum TransitionDirection { 23 | case Left 24 | case Right 25 | } 26 | 27 | public let menuContainerView = UIView() 28 | public let menuBackgroundView = UIView() 29 | 30 | weak var delegate: SlideMenuAnimatedTransitionDelegate? 31 | 32 | var transitionDirection: TransitionDirection = .Left 33 | 34 | public internal(set) var presenting: Bool = true 35 | 36 | public var revealAmount: CGFloat = 300 37 | public var animationDuration: NSTimeInterval = 0.4 38 | 39 | 40 | // MARK: - Initializers 41 | 42 | override init() { 43 | super.init() 44 | 45 | // Configure menu container view 46 | menuContainerView.addGestureRecognizer(UIPanGestureRecognizer(target: self, action: "handlePanGesture:")) 47 | 48 | // Configure menu background view 49 | menuBackgroundView.backgroundColor = UIColor.blackColor().colorWithAlphaComponent(0.6) 50 | menuBackgroundView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: "handleTapGesture:")) 51 | menuBackgroundView.addGestureRecognizer(UIPanGestureRecognizer(target: self, action: "handlePanGesture:")) 52 | } 53 | 54 | 55 | // MARK: - Actions 56 | 57 | func handleTapGesture(tapGestureRecognizer: UITapGestureRecognizer) { 58 | delegate?.slideMenuAnimatedTransition(self, handleTapGesture: tapGestureRecognizer) 59 | } 60 | 61 | func handlePanGesture(panGestureRecognizer: UIPanGestureRecognizer) { 62 | delegate?.slideMenuAnimatedTransition(self, handlePanGesture: panGestureRecognizer) 63 | } 64 | 65 | 66 | // MARK: - UIViewControllerAnimatedTransitioning 67 | 68 | public func transitionDuration(transitionContext: UIViewControllerContextTransitioning?) -> NSTimeInterval { 69 | return animationDuration 70 | } 71 | 72 | public func animateTransition(transitionContext: UIViewControllerContextTransitioning) { 73 | if presenting { 74 | animatePresentation(transitionContext) 75 | } else { 76 | animateDismissal(transitionContext) 77 | } 78 | } 79 | 80 | private func animatePresentation(transitionContext: UIViewControllerContextTransitioning) { 81 | guard let containerView = transitionContext.containerView(), 82 | let toView = transitionContext.viewForKey(UITransitionContextToViewKey) else { 83 | return 84 | } 85 | 86 | // Prelayout menu background view 87 | menuBackgroundView.frame = containerView.bounds 88 | menuBackgroundView.alpha = 0 89 | menuBackgroundView.autoresizingMask = [.FlexibleWidth, .FlexibleHeight] 90 | containerView.addSubview(menuBackgroundView) 91 | 92 | // Prelayout menu container view 93 | if transitionDirection == .Left { 94 | menuContainerView.frame = CGRectMake( 95 | -self.revealAmount, 96 | 0, 97 | self.revealAmount, 98 | CGRectGetHeight(containerView.frame) 99 | ) 100 | menuContainerView.autoresizingMask = [.FlexibleRightMargin, .FlexibleHeight] 101 | } else { 102 | menuContainerView.frame = CGRectMake( 103 | CGRectGetWidth(containerView.frame), 104 | 0, 105 | self.revealAmount, 106 | CGRectGetHeight(containerView.frame) 107 | ) 108 | menuContainerView.autoresizingMask = [.FlexibleLeftMargin, .FlexibleHeight] 109 | } 110 | 111 | containerView.insertSubview(menuContainerView, aboveSubview: menuBackgroundView) 112 | 113 | // Embed toView in menuContainerView 114 | toView.removeFromSuperview() 115 | toView.frame = menuContainerView.bounds 116 | toView.autoresizingMask = [.FlexibleWidth, .FlexibleHeight] 117 | menuContainerView.addSubview(toView) 118 | 119 | // Animation 120 | let animations = { 121 | self.menuBackgroundView.alpha = 1 122 | 123 | if self.transitionDirection == .Left { 124 | self.menuContainerView.frame = CGRectMake( 125 | 0, 126 | 0, 127 | self.revealAmount, 128 | CGRectGetHeight(containerView.frame) 129 | ) 130 | } else { 131 | self.menuContainerView.frame = CGRectMake( 132 | CGRectGetWidth(containerView.frame) - self.revealAmount, 133 | 0, 134 | self.revealAmount, 135 | CGRectGetHeight(containerView.frame) 136 | ) 137 | } 138 | } 139 | 140 | let completion = { (finished: Bool) in 141 | let cancelled = transitionContext.transitionWasCancelled() 142 | transitionContext.completeTransition(!cancelled) 143 | } 144 | 145 | if transitionContext.isInteractive() { 146 | UIView.animateWithDuration( 147 | animationDuration, 148 | delay: 0, 149 | options: [.CurveLinear], 150 | animations: animations, 151 | completion: completion 152 | ) 153 | } else { 154 | UIView.animateWithDuration( 155 | animationDuration, 156 | delay: 0, 157 | usingSpringWithDamping: 1, 158 | initialSpringVelocity: 0, 159 | options: [], 160 | animations: animations, 161 | completion: completion 162 | ) 163 | } 164 | } 165 | 166 | private func animateDismissal(transitionContext: UIViewControllerContextTransitioning) { 167 | guard let containerView = transitionContext.containerView() else { 168 | return 169 | } 170 | 171 | // Animation 172 | let animations = { 173 | self.menuBackgroundView.alpha = 0 174 | 175 | if self.transitionDirection == .Left { 176 | self.menuContainerView.frame = CGRectMake( 177 | -self.revealAmount, 178 | 0, 179 | self.revealAmount, 180 | CGRectGetHeight(containerView.frame) 181 | ) 182 | } else { 183 | self.menuContainerView.frame = CGRectMake( 184 | CGRectGetWidth(containerView.frame), 185 | 0, 186 | self.revealAmount, 187 | CGRectGetHeight(containerView.frame) 188 | ) 189 | } 190 | } 191 | 192 | let completion = { (finished: Bool) in 193 | let cancelled = transitionContext.transitionWasCancelled() 194 | transitionContext.completeTransition(!cancelled) 195 | } 196 | 197 | if transitionContext.isInteractive() { 198 | UIView.animateWithDuration( 199 | animationDuration, 200 | delay: 0, 201 | options: [.CurveLinear], 202 | animations: animations, 203 | completion: completion 204 | ) 205 | } else { 206 | UIView.animateWithDuration( 207 | animationDuration, 208 | delay: 0, 209 | usingSpringWithDamping: 1, 210 | initialSpringVelocity: 0, 211 | options: [], 212 | animations: animations, 213 | completion: completion 214 | ) 215 | } 216 | } 217 | 218 | } 219 | -------------------------------------------------------------------------------- /SlideMenu/SlideMenuController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SlideMenuViewController.swift 3 | // SlideMenu 4 | // 5 | // Created by Katsuma Tanaka on 2015/10/05. 6 | // Copyright © 2015 Katsuma Tanaka. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | public class SlideMenuController: UIViewController, UIViewControllerTransitioningDelegate, SlideMenuAnimatedTransitionDelegate { 12 | 13 | // MARK: - Properties 14 | 15 | public let animatedTransition = SlideMenuAnimatedTransition() 16 | public let interactiveTransition = UIPercentDrivenInteractiveTransition() 17 | 18 | public private(set) var interactivelyTransitioning: Bool = false 19 | 20 | public private(set) var leftScreenEdgePanGestureRecognizer: UIScreenEdgePanGestureRecognizer! 21 | public private(set) var rightScreenEdgePanGestureRecognizer: UIScreenEdgePanGestureRecognizer! 22 | 23 | public var leftViewControllerPresented: Bool { 24 | guard let leftViewController = self.leftViewController else { 25 | return false 26 | } 27 | 28 | return (!leftViewController.isBeingPresented() 29 | && leftViewController.presentingViewController != nil) 30 | } 31 | 32 | public var rightViewControllerPresented: Bool { 33 | guard let rightViewController = self.rightViewController else { 34 | return false 35 | } 36 | 37 | return (!rightViewController.isBeingPresented() 38 | && rightViewController.presentingViewController != nil) 39 | } 40 | 41 | public var mainViewController: UIViewController? { 42 | willSet { 43 | if let mainViewController = self.mainViewController { 44 | mainViewController.willMoveToParentViewController(nil) 45 | mainViewController.view.removeFromSuperview() 46 | mainViewController.removeFromParentViewController() 47 | } 48 | } 49 | 50 | didSet { 51 | if let mainViewController = self.mainViewController { 52 | addChildViewController(mainViewController) 53 | 54 | let view = mainViewController.view 55 | view.frame = self.view.bounds 56 | view.autoresizingMask = [.FlexibleWidth, .FlexibleHeight] 57 | self.view.addSubview(view) 58 | 59 | mainViewController.didMoveToParentViewController(self) 60 | } 61 | } 62 | } 63 | 64 | public var leftViewController: UIViewController? 65 | public var rightViewController: UIViewController? 66 | 67 | public var animationDuration: NSTimeInterval { 68 | set { 69 | animatedTransition.animationDuration = newValue 70 | } 71 | 72 | get { 73 | return animatedTransition.animationDuration 74 | } 75 | } 76 | 77 | public var completionThreshold: CGFloat = 0.15 78 | 79 | public var revealAmount: CGFloat { 80 | set { 81 | animatedTransition.revealAmount = newValue 82 | } 83 | 84 | get { 85 | return animatedTransition.revealAmount 86 | } 87 | } 88 | 89 | 90 | // MARK: - Initializers 91 | 92 | override public init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) { 93 | super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) 94 | 95 | commonInit() 96 | } 97 | 98 | required public init?(coder aDecoder: NSCoder) { 99 | super.init(coder: aDecoder) 100 | 101 | commonInit() 102 | } 103 | 104 | private func commonInit() { 105 | animatedTransition.delegate = self 106 | interactiveTransition.completionCurve = .EaseOut 107 | 108 | setUpScreenEdgePanGestureRecognizers() 109 | } 110 | 111 | public convenience init(mainViewController: UIViewController?, leftViewController: UIViewController?, rightViewController: UIViewController?) { 112 | self.init(nibName: nil, bundle: nil) 113 | 114 | self.mainViewController = mainViewController 115 | self.leftViewController = leftViewController 116 | self.rightViewController = rightViewController 117 | 118 | // This should be done here because `didSet` of `mainViewController` property 119 | // is not called when it is set in the initializer. 120 | if let mainViewController = self.mainViewController { 121 | addChildViewController(mainViewController) 122 | 123 | let view = mainViewController.view 124 | view.frame = self.view.bounds 125 | view.autoresizingMask = [.FlexibleWidth, .FlexibleHeight] 126 | self.view.addSubview(view) 127 | 128 | mainViewController.didMoveToParentViewController(self) 129 | } 130 | } 131 | 132 | private func setUpScreenEdgePanGestureRecognizers() { 133 | leftScreenEdgePanGestureRecognizer = UIScreenEdgePanGestureRecognizer(target: self, action: "handleScreenEdgePanGesture:") 134 | leftScreenEdgePanGestureRecognizer.edges = [.Left] 135 | view.addGestureRecognizer(leftScreenEdgePanGestureRecognizer) 136 | 137 | rightScreenEdgePanGestureRecognizer = UIScreenEdgePanGestureRecognizer(target: self, action: "handleScreenEdgePanGesture:") 138 | rightScreenEdgePanGestureRecognizer.edges = [.Right] 139 | view.addGestureRecognizer(rightScreenEdgePanGestureRecognizer) 140 | } 141 | 142 | 143 | // MARK: - View Lifecycle 144 | 145 | override public func viewDidLoad() { 146 | super.viewDidLoad() 147 | } 148 | 149 | 150 | // MARK: - Actions 151 | 152 | func handleScreenEdgePanGesture(gestureRecognizer: UIScreenEdgePanGestureRecognizer) { 153 | let left = (gestureRecognizer == leftScreenEdgePanGestureRecognizer) 154 | let location = gestureRecognizer.translationInView(gestureRecognizer.view) 155 | let progress: CGFloat 156 | if left { 157 | progress = max(0, min(location.x / revealAmount, 1.0)) 158 | } else { 159 | progress = max(0, min(-location.x / revealAmount, 1.0)) 160 | } 161 | 162 | switch gestureRecognizer.state { 163 | case .Began: 164 | interactivelyTransitioning = true 165 | 166 | if left { 167 | presentLeftViewControllerAnimated(true, completion: nil) 168 | } else { 169 | presentRightViewControllerAnimated(true, completion: nil) 170 | } 171 | 172 | case .Changed: 173 | interactiveTransition.updateInteractiveTransition(progress) 174 | 175 | case .Cancelled, .Ended, .Failed: 176 | interactiveTransition.completionSpeed = completionSpeedForProgress(progress) 177 | 178 | if progress > completionThreshold { 179 | interactiveTransition.finishInteractiveTransition() 180 | } else { 181 | interactiveTransition.cancelInteractiveTransition() 182 | } 183 | 184 | interactivelyTransitioning = false 185 | 186 | default: 187 | break 188 | } 189 | } 190 | 191 | 192 | // MARK: - Interactive Transition 193 | 194 | private func completionSpeedForProgress(progress: CGFloat) -> CGFloat { 195 | return 1.25 196 | } 197 | 198 | 199 | // MARK: - Managing Menu View Controllers 200 | 201 | public func presentLeftViewControllerAnimated(animated: Bool, completion: (() -> Void)?) { 202 | guard let leftViewController = self.leftViewController else { 203 | return 204 | } 205 | 206 | animatedTransition.transitionDirection = .Left 207 | 208 | presentMenuViewController(leftViewController, animated: animated, completion: completion) 209 | } 210 | 211 | public func presentRightViewControllerAnimated(animated: Bool, completion: (() -> Void)?) { 212 | guard let rightViewController = self.rightViewController else { 213 | return 214 | } 215 | 216 | animatedTransition.transitionDirection = .Right 217 | 218 | presentMenuViewController(rightViewController, animated: animated, completion: completion) 219 | } 220 | 221 | private func presentMenuViewController(viewController: UIViewController, animated: Bool, completion: (() -> Void)?) { 222 | viewController.transitioningDelegate = self 223 | viewController.modalPresentationStyle = .OverFullScreen 224 | 225 | presentViewController(viewController, animated: animated, completion: completion) 226 | } 227 | 228 | 229 | // MARK: - UIViewControllerTransitioningDelegate 230 | 231 | public func animationControllerForPresentedController(presented: UIViewController, presentingController presenting: UIViewController, sourceController source: UIViewController) -> UIViewControllerAnimatedTransitioning? { 232 | animatedTransition.presenting = true 233 | 234 | return animatedTransition 235 | } 236 | 237 | public func animationControllerForDismissedController(dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? { 238 | animatedTransition.presenting = false 239 | 240 | return animatedTransition 241 | } 242 | 243 | public func interactionControllerForPresentation(animator: UIViewControllerAnimatedTransitioning) -> UIViewControllerInteractiveTransitioning? { 244 | return interactivelyTransitioning ? interactiveTransition : nil 245 | } 246 | 247 | public func interactionControllerForDismissal(animator: UIViewControllerAnimatedTransitioning) -> UIViewControllerInteractiveTransitioning? { 248 | return interactivelyTransitioning ? interactiveTransition : nil 249 | } 250 | 251 | 252 | // MARK: - SlideMenuAnimatedTransitionDelegate 253 | 254 | func slideMenuAnimatedTransition(slideMenuAnimatedTransition: SlideMenuAnimatedTransition, handleTapGesture tapGestureRecognizer: UITapGestureRecognizer) { 255 | dismissViewControllerAnimated(true, completion: nil) 256 | } 257 | 258 | func slideMenuAnimatedTransition(slideMenuAnimatedTransition: SlideMenuAnimatedTransition, handlePanGesture panGestureRecognizer: UIPanGestureRecognizer) { 259 | let location = panGestureRecognizer.translationInView(panGestureRecognizer.view) 260 | let progress: CGFloat 261 | if leftViewControllerPresented { 262 | progress = max(0, min(-location.x / revealAmount, 1.0)) 263 | } else { 264 | progress = max(0, min(location.x / revealAmount, 1.0)) 265 | } 266 | 267 | switch panGestureRecognizer.state { 268 | case .Began: 269 | interactivelyTransitioning = true 270 | dismissViewControllerAnimated(true, completion: nil) 271 | 272 | case .Changed: 273 | interactiveTransition.updateInteractiveTransition(progress) 274 | 275 | case .Cancelled, .Ended, .Failed: 276 | interactiveTransition.completionSpeed = completionSpeedForProgress(progress) 277 | 278 | if progress > completionThreshold { 279 | interactiveTransition.finishInteractiveTransition() 280 | } else { 281 | interactiveTransition.cancelInteractiveTransition() 282 | } 283 | interactivelyTransitioning = false 284 | 285 | default: 286 | break 287 | } 288 | } 289 | 290 | } 291 | -------------------------------------------------------------------------------- /SlideMenuDemo/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // SlideMenuDemo 4 | // 5 | // Created by Katsuma Tanaka on 2015/10/05. 6 | // Copyright © 2015 Katsuma Tanaka. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import SlideMenu 11 | 12 | @UIApplicationMain 13 | class AppDelegate: UIResponder, UIApplicationDelegate { 14 | 15 | // MARK: - Properties 16 | 17 | var window: UIWindow? 18 | 19 | 20 | // MARK: - UIApplicationDelegate 21 | 22 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 23 | let storyboard = UIStoryboard(name: "Main", bundle: nil) 24 | let mainViewController = storyboard.instantiateViewControllerWithIdentifier("MainNavigationController") 25 | let leftViewController = storyboard.instantiateViewControllerWithIdentifier("LeftViewController") 26 | let rightViewController = storyboard.instantiateViewControllerWithIdentifier("RightViewController") 27 | 28 | let slideMenuController = SlideMenuController( 29 | mainViewController: mainViewController, 30 | leftViewController: leftViewController, 31 | rightViewController: rightViewController 32 | ) 33 | 34 | let menuContainerView = slideMenuController.animatedTransition.menuContainerView 35 | menuContainerView.layer.shadowColor = UIColor.blackColor().CGColor 36 | menuContainerView.layer.shadowOpacity = 0.4 37 | menuContainerView.layer.shadowRadius = 4.0 38 | 39 | let window = UIWindow(frame: UIScreen.mainScreen().bounds) 40 | window.rootViewController = slideMenuController 41 | window.makeKeyAndVisible() 42 | self.window = window 43 | 44 | return true 45 | } 46 | 47 | func applicationWillResignActive(application: UIApplication) { 48 | // 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. 49 | // 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. 50 | } 51 | 52 | func applicationDidEnterBackground(application: UIApplication) { 53 | // 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. 54 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 55 | } 56 | 57 | func applicationWillEnterForeground(application: UIApplication) { 58 | // 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. 59 | } 60 | 61 | func applicationDidBecomeActive(application: UIApplication) { 62 | // 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. 63 | } 64 | 65 | func applicationWillTerminate(application: UIApplication) { 66 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /SlideMenuDemo/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 | } -------------------------------------------------------------------------------- /SlideMenuDemo/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 | -------------------------------------------------------------------------------- /SlideMenuDemo/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 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | -------------------------------------------------------------------------------- /SlideMenuDemo/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.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 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 | -------------------------------------------------------------------------------- /SlideMenuDemo/LeftViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LeftViewController.swift 3 | // SlideMenuDemo 4 | // 5 | // Created by Katsuma Tanaka on 2015/10/05. 6 | // Copyright © 2015 Katsuma Tanaka. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class LeftViewController: UIViewController { 12 | 13 | // MARK: - View Lifecycle 14 | 15 | override func viewDidLoad() { 16 | super.viewDidLoad() 17 | } 18 | 19 | 20 | // MARK: - Actions 21 | 22 | @IBAction func hide(sender: AnyObject) { 23 | slideMenuController?.dismissViewControllerAnimated(true, completion: nil) 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /SlideMenuDemo/MainViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MainViewController.swift 3 | // SlideMenuDemo 4 | // 5 | // Created by Katsuma Tanaka on 2015/10/05. 6 | // Copyright © 2015 Katsuma Tanaka. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import SlideMenu 11 | 12 | class MainViewController: UIViewController { 13 | 14 | // MARK: - View Lifecycle 15 | 16 | override func viewDidLoad() { 17 | super.viewDidLoad() 18 | } 19 | 20 | 21 | // MARK: - Actions 22 | 23 | @IBAction func showLeftMenu(sender: AnyObject) { 24 | slideMenuController?.presentLeftViewControllerAnimated(true, completion: nil) 25 | } 26 | 27 | @IBAction func showRightMenu(sender: AnyObject) { 28 | slideMenuController?.presentRightViewControllerAnimated(true, completion: nil) 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /SlideMenuDemo/RightViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RightViewController.swift 3 | // SlideMenuDemo 4 | // 5 | // Created by Katsuma Tanaka on 2015/10/05. 6 | // Copyright © 2015 Katsuma Tanaka. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class RightViewController: UIViewController { 12 | 13 | // MARK: - View Lifecycle 14 | 15 | override func viewDidLoad() { 16 | super.viewDidLoad() 17 | } 18 | 19 | 20 | // MARK: - Actions 21 | 22 | @IBAction func hide(sender: AnyObject) { 23 | slideMenuController?.dismissViewControllerAnimated(true, completion: nil) 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /SlideMenuDemo/UIViewController+SlideMenu.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewController+SlideMenu.swift 3 | // SlideMenuDemo 4 | // 5 | // Created by Katsuma Tanaka on 2015/10/05. 6 | // Copyright © 2015 Katsuma Tanaka. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import SlideMenu 11 | 12 | public extension UIViewController { 13 | 14 | var slideMenuController: SlideMenuController? { 15 | // Find from parent view controller 16 | var viewController = self.parentViewController 17 | 18 | while parentViewController != nil { 19 | if let slideMenuController = viewController as? SlideMenuController { 20 | return slideMenuController 21 | } 22 | 23 | viewController = viewController?.parentViewController 24 | } 25 | 26 | // Find from presenting view controller 27 | if let slideMenuController = presentingViewController as? SlideMenuController { 28 | return slideMenuController 29 | } 30 | 31 | return nil 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /SlideMenuTests/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 | BNDL 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /SlideMenuTests/SlideMenuTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SlideMenuTests.swift 3 | // SlideMenuTests 4 | // 5 | // Created by Katsuma Tanaka on 2015/10/05. 6 | // Copyright © 2015 Katsuma Tanaka. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import SlideMenu 11 | 12 | class SlideMenuTests: XCTestCase { 13 | 14 | override func setUp() { 15 | super.setUp() 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | } 18 | 19 | override func tearDown() { 20 | // Put teardown code here. This method is called after the invocation of each test method in the class. 21 | super.tearDown() 22 | } 23 | 24 | func testExample() { 25 | // This is an example of a functional test case. 26 | // Use XCTAssert and related functions to verify your tests produce the correct results. 27 | } 28 | 29 | func testPerformanceExample() { 30 | // This is an example of a performance test case. 31 | self.measureBlock { 32 | // Put the code you want to measure the time of here. 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /screenshot.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nek023/SlideMenu/5e1216848fd8ce3e2b626e0931000a390a0355e7/screenshot.gif --------------------------------------------------------------------------------