A customizable interactive menu written in Swift with a unique design, animated graphics and sounds. The menu is made to be as easy as possible for developers who want their app to have that professional look and feel without the expense of hiring a designer. With this project we’ve aimed for simplicity by using only three basic animation loops with each loop taking about 8ms.

This interactive menu is a great example of how you can use Swift in your apps, to create user interactions that are smooth and easy to navigate. This app demonstrates usability through simplicity-the goal of any successful iOS app design.

The “hamburger menu ios swift” is a side menu that can be used in iOS. The menu was written in Swift and makes use of the new 3D Touch feature on the iPhone 6s and 6s Plus.

1635064006_35_iOS-Interactive-Side-Menu-written-in-Swift

A Swift-based configurable, interactive, auto-expanding and shrinking side menu for iOS.

Here are some options for customizing the Interactive Side Menu:

  • the length of the animation
  • Width of visible content
  • The magnitude of the content
  • Spring animations in UIView
  • Curves in animation
  • Distinct orientations have different animation settings that may be customized.

Communication

  • Please create an issue if you want assistance or discover a problem.
  • Create an issue if you have a feature request.
  • Submit a pull request if you’re ready to help.
  • Please give Interactive Side Menu a star if you like it.
  • Send us a link to your AppStore-published application that uses Interactive Side Menu, and we’ll compile a list of apps that utilize our library.

More information may be found in the CONTRIBUTING file.

Installation

CocoaPods

Add the following line to your Podfile to install using CocoaPods:

‘InteractiveSideMenu’ pod

During the migration from one version to the next, don’t forget to perform the pod update command to update your local specifications repository.

Carthage

Add the following line to your Cartfile to install using Carthage:

“handsomecode/InteractiveSideMenu” on github

Usage

Subclass the following view controllers to construct your side menu: MenuContainerViewController and MenuViewController.

  • The primary container for the side menu and content controller is MenuContainerViewController.
  • The container controller for the side menu is MenuViewController.

Your view controller must follow the SideMenuItemContent protocol in order to add a new menu item.

There are three stages to setting up the side menu:

The subclasses Host = MenuContainerViewController and Menu = MenuViewController are used for this.
  1. Assign the menuViewController property of Host to Menu.
  2. Set an array of SideMenuItemContent controllers in the Host’s contentViewControllers array.
  3. selectContentViewController(_ selectedContentVC: MenuItemContentViewController) is a selectContentViewController method called by Host.

[MenuItemContentViewController] contentList.append(self.storyboard? var contentList = [MenuItemContentViewController]() var contentList = [MenuItemContentViewController]() var contentList = [MenuItemContentViewController]() var contentList contentList.append(self.storyboard?.instantiateViewController(withIdentifier: “First”) as! MenuItemContentViewController) .instantiateViewController(withIdentifier: “Second”) as! MenuItemContentViewController) return contentList “> import InteractiveSideMenu class HostViewController: import InteractiveSideMenu class HostViewController: import InteractiveSideMenu class HostViewController: import InteractiveSideMenu class HostViewController: import InteractiveSideMenu class HostViewController: import InteractiveS override method viewDidLoad in MenuContainerViewController () menuViewController = self.storyboard! super.viewDidLoad() MenuViewController content.instantiateViewController(withIdentifier: “NavigationMenu”) as! selectContentViewController(contentViewControllers.first!) ViewControllers = contentControllers() contentControllers() -> private func contentControllers() -> [MenuItemContentViewController] var contentList = [MenuItemContentViewController]() contentList.append(self.storyboard?.instantiateViewController(withIdentifier: “First”) as! MenuItemContentViewController) contentList.append(self.storyboard?.instantiateViewController(withIdentifier: “First”) as! MenuItemContentViewController) contentList.append(self.storyboard?.instantiateViewController(withIdent as! MenuItemContentViewController).instantiateViewController(withIdentifier: “Second”) return contentList

Content of the items

Call showSideMenu() from any SideMenuItemContent controller to display the menu.

@IBAction method openMenu(_ sender: UIButton) showSideMenu() import InteractiveSideMenu class KittyViewController: UIViewController, SideMenuItemContent @IBAction func openMenu(_ sender: UIButton) showSideMenu()

Pass the appropriate controller to your MenuContainerViewController to alter the currently displayed controller:

index = 2;/ Let menuContainerViewController = self as a menu item guard. menu let contentController = menu if ContainerViewController is not returned ContainerViewController. contentViewControllers[index] menuContainerViewController. selectContentViewController(contentController) menuContainerViewController.hideSideMenu()

Controls for the TabBar and Navigation

If you want to utilize a menu with a TabBar or NavigationController, make sure the item content is UITabBarController or UINavigationController, not any ViewControllers.

UINavigationController, SideMenuItemContent class NavigationViewController if let navigationViewController = self.navigationController as? class InnerViewController: UIViewController @IBAction def openMenu(_ sender: Any) if let navigationViewController = self.navigationController as? navigationViewController.showSideMenu() SideMenuItemContent

Details on how to use UITabBarController can be found in the Sample.

Customization of Animation

Update the transitionOptions property on your MenuContainerViewColtroller subclass to tailor the open and closing animations. This is done in viewDidLoad in the example project ()

super.viewDidLoad() let screenSize: CGR override func viewDidLoad() self.transitionOptions = TransitionOptions(duration: 0.4, visible) ect = UIScreen.main.bounds 6) screenSize.width / screenWidth / screenWidth / screenWidth / screenWidth / screenWidth / screenW

Override viewWillTransition(to:with:) and alter the transitionOptions to specify transition options for various orientations. TraitCollectionDidChange(_:) may likewise be used to perform this with trait collections.

 

super.willTransitionWillTransitionWillTransitionWillTransitionWillTransition (to: size, with: coordinator) options = TransitionOptions() options var options = TransitionOptions() options var options = TransitionOptions() options size.width = duration

override the viewWillTransition function (to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) super.viewWillTransition is a function that determines whether or not a view will transition (to: size, with: coordinator) options = TransitionOptions() options var options = TransitionOptions() options var options = TransitionOptions() options options.visibleContentWidth = size.width / 6 self duration = size.width size.height? 0.4: 0.6 options.visibleContentWidth = size.width / 6 self options = transitionOptions

There is a problem with the content controller’s view not having the safeAreaInsets set correctly. When the side menu is closed, the arrangement of the display changes. The contentScale parameter in the transition settings seems to be the source of the problem. The safeAreaInsets.top is set to 0.0 when you choose a value between 0.87 and 0.91. The library’s default value is no longer inside this range, but if you change it for your own application, be careful.

The Apache License, Version 2.0, applies to InteractiveSideMenu. For further information, see the LICENSE file.

The “side menu swift github” is a project that was written in Swift. It allows users to create an interactive side menu on their iOS app.

Related Tags

  • side menu (swift programmatically)
  • popup menu swift github
  • ios side menu example
  • option menu swift github
  • slide up menu swift