Convert Figma logo to code with AI

Yalantis logoGuillotineMenu

Our Guillotine Menu Transitioning Animation implemented in Swift reminds a bit of a notorious killing machine.

2,914
253
2,914
0

Top Related Projects

:octocat: 📃 FoldingCell is an expanding content cell with animation made by @Ramotion

:octocat: RAMAnimatedTabBarController is a Swift UI module library for adding animation to iOS tabbar items and icons. iOS library made by @Ramotion

:octocat: ⭕️ CircleMenu is a simple, elegant UI menu with a circular layout and material design animations. Swift UI library made by @Ramotion

:octocat: ExpandingCollection is an animated material design UI card peek/pop controller. iOS library made by @Ramotion

:octocat: PaperOnboarding is a material design UI slider. Swift UI library by @Ramotion

Quick Overview

The Yalantis/GuillotineMenu is a custom transition animation for presenting a view controller. It provides a unique and visually appealing way to display a menu or any other view controller in your iOS application.

Pros

  • Unique Transition Animation: The Guillotine Menu offers a distinctive and eye-catching transition animation that can help your app stand out.
  • Customizable: The library provides various customization options, allowing you to adjust the animation's speed, direction, and other properties to fit your app's design.
  • Easy to Implement: The library is well-documented and provides a straightforward integration process, making it easy for developers to incorporate into their projects.
  • Smooth Performance: The Guillotine Menu animation is designed to be performant, ensuring a smooth user experience.

Cons

  • Limited Functionality: The Guillotine Menu is primarily focused on the transition animation and does not provide additional features or functionality beyond that.
  • Potential Compatibility Issues: As an older library, there may be compatibility issues with newer versions of iOS or Xcode, which could require additional work to resolve.
  • Dependency on External Library: The project relies on the Yalantis/ViewAnimator library, which adds an additional dependency to your project.
  • Limited Community Support: The Guillotine Menu project does not appear to have a large active community, which could make it challenging to find support or resolve issues.

Code Examples

// Presenting the Guillotine Menu
let guillotineMenu = GuillotineMenu(rootViewController: menuViewController)
present(guillotineMenu, animated: true, completion: nil)

This code snippet demonstrates how to present the Guillotine Menu by creating an instance of GuillotineMenu and presenting it.

// Customizing the Guillotine Menu animation
let guillotineMenu = GuillotineMenu(rootViewController: menuViewController)
guillotineMenu.animationOptions = .transitionFlipFromLeft
guillotineMenu.duration = 0.5
guillotineMenu.dismissalOptions = .transitionFlipFromRight

This example shows how to customize the Guillotine Menu animation by setting the animationOptions, duration, and dismissalOptions properties.

// Dismissing the Guillotine Menu
guillotineMenu.dismiss(animated: true, completion: nil)

This code snippet demonstrates how to dismiss the Guillotine Menu.

Getting Started

To get started with the Guillotine Menu, follow these steps:

  1. Add the Yalantis/GuillotineMenu library to your project. You can do this using a package manager like CocoaPods or Carthage, or by manually adding the source files to your project.

  2. Import the Guillotine Menu library in your code:

    import GuillotineMenu
    
  3. Create an instance of GuillotineMenu and present it:

    let guillotineMenu = GuillotineMenu(rootViewController: menuViewController)
    present(guillotineMenu, animated: true, completion: nil)
    
  4. Customize the Guillotine Menu animation as needed:

    guillotineMenu.animationOptions = .transitionFlipFromLeft
    guillotineMenu.duration = 0.5
    guillotineMenu.dismissalOptions = .transitionFlipFromRight
    
  5. Dismiss the Guillotine Menu when necessary:

    guillotineMenu.dismiss(animated: true, completion: nil)
    

That's the basic setup for using the Guillotine Menu in your iOS application. Refer to the project's documentation for more advanced usage and customization options.

Competitor Comparisons

:octocat: 📃 FoldingCell is an expanding content cell with animation made by @Ramotion

Pros of folding-cell

  • More versatile animation options, allowing for complex folding effects
  • Supports both Swift and Objective-C, making it accessible to a wider range of developers
  • Highly customizable with various animation parameters and styles

Cons of folding-cell

  • May have a steeper learning curve due to its more complex animation system
  • Potentially higher performance overhead for intricate folding animations
  • Less suitable for simple menu transitions compared to GuillotineMenu

Code Comparison

folding-cell:

let cell = FoldingCell()
cell.itemCount = 4
cell.backgroundColor = .clear
cell.foregroundView.backgroundColor = .white
cell.foregroundView.layer.cornerRadius = 10

GuillotineMenu:

let menuButton = UIButton()
let menu = GuillotineMenu(menuButton: menuButton)
menu.delegate = self
menu.supportedOrientations = .portrait
menu.animationDuration = 0.5

Both libraries offer unique animation styles for iOS applications. GuillotineMenu focuses on a specific menu transition effect, while folding-cell provides a more flexible folding animation system that can be applied to various UI elements. The choice between the two depends on the specific design requirements and complexity of the desired animations in your project.

:octocat: RAMAnimatedTabBarController is a Swift UI module library for adding animation to iOS tabbar items and icons. iOS library made by @Ramotion

Pros of animated-tab-bar

  • More versatile, offering various animation styles for tab bar items
  • Supports both Swift and Objective-C
  • Actively maintained with recent updates

Cons of animated-tab-bar

  • Focused solely on tab bar animations, less flexible for other menu types
  • May require more setup and customization for complex use cases

Code Comparison

GuillotineMenu:

let menuButton = UIButton()
let menu = GuillotineMenu(menuButton: menuButton)
menu.delegate = self
view.addSubview(menu)

animated-tab-bar:

let tabBar = RAMAnimatedTabBarController()
tabBar.viewControllers = [firstVC, secondVC]
tabBar.animationTabBarHidden = false

Summary

GuillotineMenu provides a unique, full-screen menu animation, while animated-tab-bar focuses on enhancing standard tab bar interactions. GuillotineMenu offers a more dramatic and immersive menu experience, but animated-tab-bar provides greater flexibility for tab-based navigation with various animation options. The choice between the two depends on the specific design requirements and navigation structure of your app.

:octocat: ⭕️ CircleMenu is a simple, elegant UI menu with a circular layout and material design animations. Swift UI library made by @Ramotion

Pros of circle-menu

  • Circular layout provides a unique and visually appealing design
  • Supports both icon-only and icon-with-text menu items
  • Customizable animation duration and easing

Cons of circle-menu

  • Limited to a maximum of 8 menu items
  • May not be suitable for apps with complex navigation structures
  • Requires more screen space when expanded compared to GuillotineMenu

Code Comparison

circle-menu:

let circleMenu = CircleMenu(
    frame: view.bounds,
    normalIcon:"icon_menu",
    selectedIcon:"icon_close",
    buttonsCount: 4,
    duration: 4,
    distance: 120)
view.addSubview(circleMenu)

GuillotineMenu:

let menuButton = UIButton(frame: CGRect(x: 0, y: 0, width: 30, height: 30))
let guillotineMenu = GuillotineMenu(menuButton: menuButton)
guillotineMenu.delegate = self
navigationItem.leftBarButtonItem = UIBarButtonItem(customView: menuButton)

Both libraries offer unique menu implementations for iOS apps. circle-menu provides a visually striking circular layout, while GuillotineMenu offers a more traditional slide-out menu with a distinctive animation. The choice between the two depends on the specific design requirements and navigation complexity of the app.

:octocat: ExpandingCollection is an animated material design UI card peek/pop controller. iOS library made by @Ramotion

Pros of expanding-collection

  • More versatile and customizable UI component
  • Supports both vertical and horizontal scrolling
  • Provides a more immersive and interactive user experience

Cons of expanding-collection

  • More complex implementation and setup
  • Potentially higher performance overhead due to advanced animations
  • May require more design assets and planning for optimal use

Code Comparison

GuillotineMenu:

let menuButton = UIButton()
let menu = GuillotineMenu()
menu.presentationStyle = .slideInBounce(from: .left)
menu.present(from: menuButton, in: view)

expanding-collection:

let layout = ExpandingCollectionViewLayout()
let collectionView = UICollectionView(frame: .zero, collectionViewLayout: layout)
collectionView.register(ExpandingCollectionViewCell.self, forCellWithReuseIdentifier: "cell")
collectionView.expandingDelegate = self
collectionView.reloadData()

Both repositories offer unique UI components for iOS applications. GuillotineMenu focuses on a specific menu animation style, while expanding-collection provides a more flexible and feature-rich collection view implementation. The choice between the two depends on the specific requirements of your project and the desired user experience.

:octocat: PaperOnboarding is a material design UI slider. Swift UI library by @Ramotion

Pros of paper-onboarding

  • Offers a more comprehensive onboarding experience with multiple screens and transitions
  • Provides a modern and visually appealing design for user onboarding
  • Includes customizable animations and transitions between onboarding steps

Cons of paper-onboarding

  • May be more complex to implement and customize compared to GuillotineMenu
  • Focuses specifically on onboarding, while GuillotineMenu is a more versatile menu component
  • Potentially higher learning curve for developers new to the library

Code Comparison

GuillotineMenu:

let menuButton = UIButton()
let menu = GuillotineMenu()
menu.presentationStyle = .slideInBounce(from: .left)
menu.present(above: self.view, menuButton: menuButton)

paper-onboarding:

let onboarding = PaperOnboarding()
onboarding.dataSource = self
onboarding.delegate = self
view.addSubview(onboarding)

Both libraries offer easy-to-use APIs, but paper-onboarding requires implementing data source and delegate methods for customization, while GuillotineMenu focuses on menu presentation and animation. GuillotineMenu is more suitable for creating animated menus, while paper-onboarding is specifically designed for creating onboarding experiences with multiple screens and transitions.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

GuillotineMenu.swift

pod version Platform Yalantis

Preview

Inspired by this project on Dribbble

Also, read how it was done in our blog

Requirements

  • iOS 8.0+
  • Xcode 10
  • Swift 5.0 (v 4.1+)
  • Swift 4.2 (v 4.0)

Installation

CocoaPods

pod 'GuillotineMenu'

Manual Installation

You are welcome to see the sample of the project for fully operating sample in the Example folder.

  • You must add "GuillotineMenuTransitionAnimation.swift" to your project, that's all.

Usage

  • Now, it's for you to decide, should or not your menu drop from top left corner of the screen or from your navigation bar, because if you want animation like in example, you must make your menu view controller confirm to "GuillotineMenu" protocol. When you confirm to this protocol, you must make a menu button and title, you don't need to make frame for them, because animator will make it itself.
  • In view controller, that will present your menu, you must make a property for "GuillotineMenuTransitionAnimator". It's necessary for proper animation when you show or dismiss menu.
  • When you present menu, you must ensure, that model presentation style set to Custom and menu's transition delegate set to view controller, that presents menu:
let menuViewController = storyboard!.instantiateViewController(withIdentifier: "MenuViewController")
menuViewController.modalPresentationStyle = .custom
menuViewController.transitioningDelegate = self
  • Implement UIViewControllerTransitionDelegate methods in your presenting view controller:
extension ViewController: UIViewControllerTransitioningDelegate {

func animationControllerForPresentedController(presented: UIViewController, presentingController presenting: UIViewController, sourceController source: UIViewController) -> UIViewControllerAnimatedTransitioning? {
	presentationAnimator.mode = .presentation
	return presentationAnimator
}

func animationControllerForDismissedController(dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {
	presentationAnimator.mode = .dismissal
	return presentationAnimator
}
  • At last, you can assign offset view, from where your menu will be dropped and button for it, and present your menu:
presentationAnimator.supportView = navigationController!.navigationBar
presentationAnimator.presentButton = sender
present(menuViewController, animated: true, completion: nil)

Customisation

Of course, you can assign different "supportView" or "presentButton" for menu, but we think that's the best case would be behaviour like in Example project.

To specify the length of an animation effect, change the value of the "duration" property.

Also, you have wonderful delegate methods of animator:

public protocol GuillotineAnimationDelegate: class {
	
    func animatorDidFinishPresentation(_ animator: GuillotineTransitionAnimation)
    func animatorDidFinishDismissal(_ animator: GuillotineTransitionAnimation)
    func animatorWillStartPresentation(_ animator: GuillotineTransitionAnimation)
    func animatorWillStartDismissal(_ animator: GuillotineTransitionAnimation)
}

You can do whatever you want alongside menu is animating.

Let us know!

We’d be really happy if you sent us links to your projects where you use our component. Just send an email to github@yalantis.com And do let us know if you have any questions or suggestion regarding the animation.

P.S. We’re going to publish more awesomeness wrapped in code and a tutorial on how to make UI for iOS (Android) better than better. Stay tuned!

License

The MIT License (MIT)

Copyright © 2017 Yalantis

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.