{"id":13496170,"url":"https://github.com/Friend-LGA/LGSideMenuController","last_synced_at":"2025-03-28T18:31:33.467Z","repository":{"id":34108834,"uuid":"37937492","full_name":"Friend-LGA/LGSideMenuController","owner":"Friend-LGA","description":"iOS view controller which manages left and right side views","archived":false,"fork":false,"pushed_at":"2022-09-01T04:36:22.000Z","size":7939,"stargazers_count":2053,"open_issues_count":21,"forks_count":330,"subscribers_count":49,"default_branch":"master","last_synced_at":"2024-10-29T15:35:05.203Z","etag":null,"topics":["ios","lgsidemenucontroller","side-menu","side-menu-controller","side-view","side-view-controller","sidemenu","sidemenucontroller","sideview","sideviewcontroller","slide-menu","slide-menu-controller","slidemenu","slidemenucontroller","uiviewcontroller","viewcontroller"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Friend-LGA.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-06-23T18:34:18.000Z","updated_at":"2024-10-16T16:29:02.000Z","dependencies_parsed_at":"2022-08-08T00:01:08.083Z","dependency_job_id":null,"html_url":"https://github.com/Friend-LGA/LGSideMenuController","commit_stats":null,"previous_names":[],"tags_count":32,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Friend-LGA%2FLGSideMenuController","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Friend-LGA%2FLGSideMenuController/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Friend-LGA%2FLGSideMenuController/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Friend-LGA%2FLGSideMenuController/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Friend-LGA","download_url":"https://codeload.github.com/Friend-LGA/LGSideMenuController/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244259901,"owners_count":20424635,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ios","lgsidemenucontroller","side-menu","side-menu-controller","side-view","side-view-controller","sidemenu","sidemenucontroller","sideview","sideviewcontroller","slide-menu","slide-menu-controller","slidemenu","slidemenucontroller","uiviewcontroller","viewcontroller"],"created_at":"2024-07-31T19:01:43.298Z","updated_at":"2025-03-28T18:31:32.411Z","avatar_url":"https://github.com/Friend-LGA.png","language":"Swift","readme":"# LGSideMenuController\n\niOS view controller which manages left and right side views.\n\n[![Platform](https://img.shields.io/cocoapods/p/LGSideMenuController.svg)](https://github.com/Friend-LGA/LGSideMenuController)\n[![SwiftPM](https://img.shields.io/badge/SwiftPM-Compatible-brightgreen)](https://swift.org/package-manager)\n[![CocoaPods](https://img.shields.io/cocoapods/v/LGSideMenuController.svg)](http://cocoadocs.org/docsets/LGSideMenuController)\n[![Carthage](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg)](https://github.com/Friend-LGA/LGSideMenuController)\n[![License](http://img.shields.io/cocoapods/l/LGSideMenuController.svg)](https://raw.githubusercontent.com/Friend-LGA/LGSideMenuController/master/LICENSE)\n\n# Preview\n\nPresentation Style: Scale From Big\n\n\u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/672f952ec7277d65982d65a104384cd3163749a4/LGSideMenuController/Preview/ScaleFromBig.gif\" height=\"480\"/\u003e \u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/672f952ec7277d65982d65a104384cd3163749a4/LGSideMenuController/Preview/ScaleFromBig1.jpg\" height=\"480\"/\u003e \u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/672f952ec7277d65982d65a104384cd3163749a4/LGSideMenuController/Preview/ScaleFromBig2.jpg\" height=\"480\"/\u003e\n\nPresentation Style: Slide Above Blurred\n\n\u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/672f952ec7277d65982d65a104384cd3163749a4/LGSideMenuController/Preview/SlideAboveBlurred.gif\" height=\"480\"/\u003e  \u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/672f952ec7277d65982d65a104384cd3163749a4/LGSideMenuController/Preview/SlideAboveBlurred1.jpg\" height=\"480\"/\u003e \u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/672f952ec7277d65982d65a104384cd3163749a4/LGSideMenuController/Preview/SlideAboveBlurred2.jpg\" height=\"480\"/\u003e\n\nPresentation Style: Slide Below Shifted\n\n\u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/672f952ec7277d65982d65a104384cd3163749a4/LGSideMenuController/Preview/SlideBelowShifted.gif\" height=\"480\"/\u003e \u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/672f952ec7277d65982d65a104384cd3163749a4/LGSideMenuController/Preview/SlideBelowShifted1.jpg\" height=\"480\"/\u003e \u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/672f952ec7277d65982d65a104384cd3163749a4/LGSideMenuController/Preview/SlideBelowShifted2.jpg\" height=\"480\"/\u003e\n\nPresentation Style: Slide Aside + Usage: Inside UINavigationController\n\n\u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/25ab622bbb345a7a41fc41aec71fb0ed83c0fc0d/LGSideMenuController/Preview/SlideAside_InsideNavVC.gif\" height=\"480\"/\u003e \u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/25ab622bbb345a7a41fc41aec71fb0ed83c0fc0d/LGSideMenuController/Preview/SlideAside_InsideNavVC1.jpg\" height=\"480\"/\u003e \u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/25ab622bbb345a7a41fc41aec71fb0ed83c0fc0d/LGSideMenuController/Preview/SlideAside_InsideNavVC2.jpg\" height=\"480\"/\u003e\n\nOther presentation styles and examples of usage you can try in included [demo projects](https://github.com/Friend-LGA/LGSideMenuController/tree/master/Demo).\nAlso you can make your very own style, as they are highly customizable.\n\n# Installation\n\n| LGSideMenuController Version | Min iOS Version | Language    |\n|------------------------------|-----------------|-------------|\n| 1.0.0 - 1.0.10               | 6.0             | Objective-C |\n| 1.1.0 - 2.2.0                | 8.0             | Objective-C |\n| 2.3.0                        | 9.0             | Objective-C |\n| 3.0.0                        | 9.0             | Swift       |\n\n## With Source Code\n\n1. [Download repository](https://github.com/Friend-LGA/LGSideMenuController/archive/master.zip)\n2. Add [LGSideMenuController directory](https://github.com/Friend-LGA/LGSideMenuController/blob/master/LGSideMenuController/) to your project\n3. Enjoy!\n\n## With Swift Package Manager\n\nStarting with Xcode 9.0 you can use built-in swift package manager, follow [apple documentation](https://developer.apple.com/documentation/swift_packages).\nFirst supported version is `2.3.0`.\n\n## With CocoaPods\n\nCocoaPods is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries in your projects. To install with CocoaPods, follow the \"Get Started\" section on [CocoaPods](https://cocoapods.org/).\n\n### Podfile\n\n```ruby\nplatform :ios, '9.0'\nuse_frameworks!\npod 'LGSideMenuController'\n```\n\nThen import framework where you need to use the library:\n\n```swift\nimport LGSideMenuController\n```\n\n## With Carthage\n\nCarthage is a lightweight dependency manager for Swift and Objective-C. It leverages CocoaTouch modules and is less invasive than CocoaPods. To install with carthage, follow instructions on [Carthage](https://github.com/Carthage/Carthage/).\n\n### Cartfile\n\n```ruby\ngithub \"Friend-LGA/LGSideMenuController\"\n```\n\nThen import framework where you need to use the library:\n\n```swift\nimport LGSideMenuController\n```\n\n# Usage\n\n`LGSideMenuController` is inherited from `UIViewController`, so you can use it the same way as any other `UIViewController`.\n\nFirst, you need to provide basic view controllers or views, which will be used to show root, left and right views. \n\n- `rootViewController` or `rootView`.\nThis view controller or view will be used as the root view.\n- `leftViewController` or `leftView`.\nThis view controller or view will be used as the left side view.\n- `rightViewController` or `rightView`.\nThis view controller or view will be used as the right side view.\n\n```swift\n// You don't have to assign both: left and right side views. \n// Just one is enough, but you can use both if you want.\n// UIViewController() and UIView() here are just as an example. \n// Use any UIViewController or UIView to assign, as you wish.\n\nlet sideMenuController = \n    LGSideMenuController(rootViewController: UIViewController(),\n                         leftViewController: UIViewController(),\n                         rightViewController: UIViewController())\n\n// ===== OR =====\n\nlet sideMenuController = \n    LGSideMenuController(rootView: UIView(),\n                         leftView: UIView(),\n                         rightView: UIView())\n\n// ===== OR =====\n\nlet sideMenuController = LGSideMenuController()\nsideMenuController.rootViewController = UIViewController()\nsideMenuController.leftViewController = UIViewController()\nsideMenuController.rightViewController = UIViewController()\n\n// ===== OR =====\n\nlet sideMenuController = LGSideMenuController()\nsideMenuController.rootView = UIView()\nsideMenuController.leftView = UIView()\nsideMenuController.rightView = UIView()\n```\n\nSecond, you probably want to choose presentation style, there are a few:\n- `scaleFromBig`. \nSide view is located below the root view and when appearing is changing its scale from large to normal.\nRoot view also is going to be minimized and moved aside.\n- `scaleFromLittle`. \nSide view is located below the root view and when appearing is changing its scale from small to normal.\nRoot view also is going to be minimized and moved aside.\n- `slideAbove`.\nSide view is located above the root view and when appearing is sliding from a side.\nRoot view is staying still.\n- `slideAboveBlurred`. \nSide view is located above the root view and when appearing is sliding from a side.\nRoot view is staying still.\nSide view has blurred background.\n- `slideBelow`.\nSide view is located below the root view.\nRoot view is going to be moved aside.\n- `slideBelowShifted`. \nSide view is located below the root view.\nRoot view is going to be moved aside.\nAlso content of the side view has extra shifting.\n- `slideAside`.\nSide view is located at the same level as root view and when appearing is sliding from a side.\nRoot view is going to be moved together with the side view.\n\n```swift\nsideMenuController.leftViewPresentationStyle = .slideAboveBlurred\nsideMenuController.rightViewPresentationStyle = .slideBelowShifted\n```\n\nThird, you might want to change width of your side view.\nBy default it's calculated as smallest side of the screen minus `44.0`, then compare it to `320.0` and choose smallest number.\nLike so: `min(min(UIScreen.main.bounds.width, UIScreen.main.bounds.height) - 44.0, 320.0)`.\n\n```swift\nsideMenuController.leftViewWidth = 250.0\nsideMenuController.rightViewWidth = 100.0\n```\n\nTo show/hide side views just use any of these and similar methods:\n\n```swift\n// ===== LEFT =====\n\n/// Shows left side view.\nfunc showLeftView()\n\n/// Hides left side view.\nfunc hideLeftView()\n\n/// Toggle (shows/hides) left side view.\nfunc toggleLeftView()\n\n// ===== RIGHT =====\n\n/// Shows right side view.\nfunc showRightView()\n\n/// Hides right side view.\nfunc hideRightView()\n\n/// Toggle (shows/hides) right side view.\nfunc toggleRightView()\n```\n\n# Quick Example\n\nYou don't have to create both: left and right side views. Just one is enough, but you can use both if you want.\nWe create them here just as an example.\n\n## Without Storyboard\n\n1. Create root view controller (for example `UINavigationController`).\n2. Create left view controller (for example `UITableViewController`).\n3. Create right view controller (for example `UITableViewController`).\n4. Create instance of LGSideMenuController with these controllers.\n5. Configure.\n\n```swift\n// Simple AppDelegate.swift\n// Just as an example. Don't take it as a strict approach.\n\nimport UIKit\nimport LGSideMenuController\n\n@main\nclass AppDelegate: UIResponder, UIApplicationDelegate {\n\n    var window: UIWindow?\n\n    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -\u003e Bool {\n        // 1. Create root view controller.\n        // Here it is just simple `UINavigationController`.\n        // Read apple documentation and google to create one:\n        // https://developer.apple.com/documentation/uikit/uinavigationcontroller\n        // https://google.com/search?q=uinavigationcontroller+example\n        let rootNavigationController = UINavigationController(rootViewController: UIViewController())\n\n        // 2. Create left and right view controllers.\n        // Here it is just simple `UITableViewController`.\n        // Read apple documentation and google to create one:\n        // https://developer.apple.com/documentation/uikit/uitableviewcontroller\n        // https://google.com/search?q=uitableviewcontroller+example\n        let leftViewController = UITableViewController()\n        let rightViewController = UITableViewController()\n\n        // 3. Create instance of LGSideMenuController with above controllers as root and left.\n        let sideMenuController = LGSideMenuController(rootViewController: rootNavigationController,\n                                                      leftViewController: leftViewController,\n                                                      rightViewController: rightViewController)\n\n        // 4. Set presentation style by your taste if you don't like the default one.\n        sideMenuController.leftViewPresentationStyle = .slideAboveBlurred\n        sideMenuController.rightViewPresentationStyle = .slideBelowShifted\n\n        // 5. Set width for the left view if you don't like the default one.\n        sideMenuController.leftViewWidth = 250.0\n        sideMenuController.rightViewWidth = 100.0\n\n        // 6. Make it `rootViewController` for your window.\n        self.window = UIWindow(frame: UIScreen.main.bounds)\n        self.window!.rootViewController = sideMenuController\n        self.window!.makeKeyAndVisible()\n\n        // 7. Done!\n        return true\n    }\n\n}\n```\n\nFor deeper examples check [NonStoryboard Demo Project](https://github.com/Friend-LGA/LGSideMenuController/tree/master/Demo/NonStoryboard).\n\n## With Storyboard\n\n1. Create instance of `LGSideMenuController` as initial view controller for your `Storyboard`.\n2. Create root view controller (for example `UINavigationController`).\n3. Create left view controller (for example `UITableViewController`).\n4. Create right view controller (for example `UITableViewController`).\n5. Now you need to connect them all using segues of class `LGSideMenuSegue` with identifiers: `root`, `left` and `right`.\n\n\u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/dcb1aa9f4ce0fc1e7ded0ab595f6d346b1698e43/LGSideMenuController/Storyboard_Instructions/Segues/Root1.png\" height=\"300\"/\u003e \u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/dcb1aa9f4ce0fc1e7ded0ab595f6d346b1698e43/LGSideMenuController/Storyboard_Instructions/Segues/Root2.png\" height=\"300\"/\u003e \u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/dcb1aa9f4ce0fc1e7ded0ab595f6d346b1698e43/LGSideMenuController/Storyboard_Instructions/Segues/Root3.png\" height=\"300\"/\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/dcb1aa9f4ce0fc1e7ded0ab595f6d346b1698e43/LGSideMenuController/Storyboard_Instructions/Segues/Left1.png\" height=\"300\"/\u003e \u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/dcb1aa9f4ce0fc1e7ded0ab595f6d346b1698e43/LGSideMenuController/Storyboard_Instructions/Segues/Left2.png\" height=\"300\"/\u003e \u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/dcb1aa9f4ce0fc1e7ded0ab595f6d346b1698e43/LGSideMenuController/Storyboard_Instructions/Segues/Left3.png\" height=\"300\"/\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/dcb1aa9f4ce0fc1e7ded0ab595f6d346b1698e43/LGSideMenuController/Storyboard_Instructions/Segues/Right1.png\" height=\"300\"/\u003e \u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/dcb1aa9f4ce0fc1e7ded0ab595f6d346b1698e43/LGSideMenuController/Storyboard_Instructions/Segues/Right2.png\" height=\"300\"/\u003e \u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/dcb1aa9f4ce0fc1e7ded0ab595f6d346b1698e43/LGSideMenuController/Storyboard_Instructions/Segues/Right3.png\" height=\"300\"/\u003e\n\n6. You can change `leftViewWidth`, `rightViewWidth` and most of the other properties inside `LGSideMenuController`'s attributes inspector. \n\n\u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/d46bbba932f09fc91d91ada65d7060abec2be807/LGSideMenuController/Storyboard_Instructions/Properties.png\" width=\"280\"/\u003e\n\n7. `enum` properties are not yet supported (by apple) inside Xcode builder, so to change `leftViewPresentationStyle` and `rightViewPresentationStyle` you will need to do it programmatically. For this you will need to create counterpart for your `LGSideMenuController` and change these values inside. This is done by creating `LGSideMenuController` subclass and assigning this class to your view controller inside `Storyboard`'s custom class section.\n\n```swift\n// SideMenuController.swift\n\nimport UIKit\nimport LGSideMenuController\n\nclass SideMenuController: LGSideMenuController {\n\n    // `viewDidLoad` probably the best place to assign them.\n    // But if necessary you can do it in other places as well.\n    override func viewDidLoad() {\n        super.viewDidLoad()\n\n        leftViewPresentationStyle = .slideAboveBlurred\n        rightViewPresentationStyle = .slideBelowShifted\n    }\n\n}\n```\n\nFor deeper examples check [Storyboard Demo Project](https://github.com/Friend-LGA/LGSideMenuController/tree/master/Demo/Storyboard).\n\n# Wiki\n\nIf you still have questions, please take a look at the [wiki](https://github.com/Friend-LGA/LGSideMenuController/wiki).\n\n# More\n\nFor more details see [files itself](https://github.com/Friend-LGA/LGSideMenuController/tree/master/LGSideMenuController) and try Xcode [demo projects](https://github.com/Friend-LGA/LGSideMenuController/tree/master/Demo):\n* [Without Storyboard](https://github.com/Friend-LGA/LGSideMenuController/tree/master/Demo/NonStoryboard)\n* [With Storyboard](https://github.com/Friend-LGA/LGSideMenuController/tree/master/Demo/Storyboard)\n\n# Frameworks\n\nIf you like LGSideMenuController, check out my other useful libraries:\n* [LGAlertView](https://github.com/Friend-LGA/LGAlertView)\n  Customizable implementation of UIAlertViewController, UIAlertView and UIActionSheet. All in one. You can customize every detail. Make AlertView of your dream! :)\n* [LGPlusButtonsView](https://github.com/Friend-LGA/LGPlusButtonsView)\n  Customizable iOS implementation of Floating Action Button (Google Plus Button, fab).\n\n# License\n\nLGSideMenuController is released under the MIT license. See [LICENSE](https://raw.githubusercontent.com/Friend-LGA/LGSideMenuController/master/LICENSE) for details.\n","funding_links":[],"categories":["Swift","Objective-C  Stars 1000以内排名整理"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFriend-LGA%2FLGSideMenuController","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FFriend-LGA%2FLGSideMenuController","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFriend-LGA%2FLGSideMenuController/lists"}