Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Yalantis/GuillotineMenu
Our Guillotine Menu Transitioning Animation implemented in Swift reminds a bit of a notorious killing machine.
https://github.com/Yalantis/GuillotineMenu
animation cocoapods guillotinemenu ios protocol swift transition-animation yalantis
Last synced: 22 days ago
JSON representation
Our Guillotine Menu Transitioning Animation implemented in Swift reminds a bit of a notorious killing machine.
- Host: GitHub
- URL: https://github.com/Yalantis/GuillotineMenu
- Owner: Yalantis
- License: mit
- Created: 2015-04-14T08:20:37.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2020-04-13T12:49:18.000Z (over 4 years ago)
- Last Synced: 2024-04-27T18:43:50.637Z (4 months ago)
- Topics: animation, cocoapods, guillotinemenu, ios, protocol, swift, transition-animation, yalantis
- Language: Swift
- Homepage: https://yalantis.com/
- Size: 964 KB
- Stars: 2,915
- Watchers: 117
- Forks: 253
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: .github/contributing.md
- License: LICENSE
Awesome Lists containing this project
- awesome-ios - GuillotineMenu - Our Guillotine Menu Transitioning Animation implemented in Swift reminds a bit of a notorious killing machine. (UI / Menu)
- awesome-swift - GuillotineMenu - Guillotine style menu. (Libs / UI)
- awesome-cocoa - GuillotineMenu
- awesome-swift - GuillotineMenu - Guillotine style menu. (Libs / UI)
- awesome-ios-star - GuillotineMenu - Our Guillotine Menu Transitioning Animation implemented in Swift reminds a bit of a notorious killing machine. (UI / Menu)
- fucking-awesome-swift - GuillotineMenu - Guillotine style menu. (Libs / UI)
- awesome-ios - GuillotineMenu - Our Guillotine Menu Transitioning Animation implemented in Swift reminds a bit of a notorious killing machine [β’](https://raw.githubusercontent.com/Yalantis/GuillotineMenu/master/example.gif) (Content / Menu)
- awesome-swift-cn - GuillotineMenu - Guillotine style menu. (Libs / UI)
- Awesome-Mobile-UI - GuillotineMenu
- awesome-swift - GuillotineMenu - Our Guillotine Menu Transitioning Animation implemented in Swift reminds a bit of a notorious killing machine. ` π a year ago` (UI [π](#readme))
README
# GuillotineMenu.swift
[![pod version](https://img.shields.io/cocoapods/v/GuillotineMenu.svg)](https://img.shields.io/cocoapods/v/GuillotineMenu.svg)
[![Platform](https://img.shields.io/cocoapods/p/GuillotineMenu.svg?style=flat)](https://github.com/Yalantis/GuillotineMenu)
[![Yalantis](https://github.com/Yalantis/GuillotineMenu/blob/master/badge_dark.png)](https://yalantis.com/?utm_source=github)![Preview](https://github.com/Yalantis/GuillotineMenu/blob/master/example.gif)
Inspired by [this project on Dribbble](https://dribbble.com/shots/2018249-Side-Topbar-Animation)
Also, read how it was done in our [blog](https://yalantis.com/blog/how-we-created-guillotine-menu-animation/)
## Requirements
- iOS 8.0+
- Xcode 10
- Swift 5.0 (v 4.1+)
- Swift 4.2 (v 4.0)## Installation
#### [CocoaPods](http://cocoapods.org)
```ruby
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:```swift
let menuViewController = storyboard!.instantiateViewController(withIdentifier: "MenuViewController")
menuViewController.modalPresentationStyle = .custom
menuViewController.transitioningDelegate = self
```* Implement UIViewControllerTransitionDelegate methods in your presenting view controller:
```swift
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:
```swift
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:
```swift
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 [email protected] 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.