Skip to content

Commit 6aca80e

Browse files
committed
Update readme
1 parent e7c673e commit 6aca80e

File tree

1 file changed

+22
-19
lines changed

1 file changed

+22
-19
lines changed

README.md

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
#Side Menu
1+
#Side Menu
2+
23
[![Platform](http://img.shields.io/badge/platform-iOS-blue.svg?style=flat)](http://cocoapods.org/?q=YALSideMenu)
34
[![License](http://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://github.com/Yalantis/Side-Menu.iOS/blob/master/LICENSE)
45

@@ -11,7 +12,9 @@ Check this <a href="https://www.behance.net/gallery/20411445/Mobile-Animations-I
1112

1213
##Requirements
1314

14-
iOS 7.x / 8.x / 9.x (see installation instructions)
15+
- iOS 7.x / 8.x / 9.x (see installation instructions)
16+
- Swift 3
17+
- Xcode 8
1518

1619
##Installation
1720

@@ -20,7 +23,7 @@ iOS 7.x / 8.x / 9.x (see installation instructions)
2023
Simply add the following line to your Podfile:
2124

2225
```ruby
23-
pod 'YALSideMenu'
26+
pod 'YALSideMenu', '~> 2.0'
2427
```
2528

2629
*(CocoaPods v0.36 or later required. See [this blog post](http://blog.cocoapods.org/Pod-Authors-Guide-to-CocoaPods-Frameworks/) for details.)*
@@ -50,8 +53,8 @@ pod 'YALSideMenu'
5053

5154
```swift
5255
class MyFancyMenuViewController: UIViewController, Menu {
53-
@IBOutlet
54-
var menuItems = [UIView] ()
56+
@IBOutlet var menuItems = [UIView] ()
57+
}
5558
```
5659

5760
3. Set `preferredContentSize` in menu view controller to specify the desired menu width
@@ -66,27 +69,27 @@ pod 'YALSideMenu'
6669
5. Initialize an animator for presentation with parameters
6770

6871
```swift
69-
menuAnimator = MenuTransitionAnimator(mode: .Presentation, shouldPassEventsOutsideMenu: false) { [unowned self] in
70-
self.dismissViewControllerAnimated(true, completion: nil)
72+
menuAnimator = MenuTransitionAnimator(mode: .presentation, shouldPassEventsOutsideMenu: false) { [unowned self] in
73+
self.dismiss(animated: true, completion: nil)
7174
}
7275
```
7376
If you want, for example, to dismiss your menu when a tap outside menu takes place, you should pass 'false' to 'shouldPassEventsOutsideMenu' flag and assign a 'tappedOutsideHandler'.In fact, you are free to do whatever you want when a tap outside menu occurs or, if you want to have access to your content view controller, just pass 'true' and assign 'tappedOutsideHandler' to nil.
7477
6. Implement class of UIViewControllerTransitioningDelegate that will return our menuAnimator from method animationControllerForPresentedController and assign it to transitioningDelegate of menu view controller(Don't forget to set .Custom modal presentation style). To dismiss menu you should return MenuTransitionAnimator(mode: .Dismissal) from animationControllerForDismissedController method.
7578

7679
```swift
77-
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
78-
let menu = segue.destinationViewController as! MenuViewController
79-
menu.transitioningDelegate = self
80-
menu.modalPresentationStyle = .Custom
81-
}
82-
83-
func animationControllerForPresentedController(presented: UIViewController, presentingController _: UIViewController,
84-
sourceController _: UIViewController) -> UIViewControllerAnimatedTransitioning? {
85-
return menuAnimator
80+
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
81+
let menu = segue.destination as! MenuViewController
82+
menu.transitioningDelegate = self
83+
menu.modalPresentationStyle = .custom
8684
}
8785

88-
func animationControllerForDismissedController(dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {
89-
return MenuTransitionAnimator(mode: .Dismissal)
86+
func animationController(forPresented presented: UIViewController, presenting _: UIViewController,
87+
source _: UIViewController) -> UIViewControllerAnimatedTransitioning? {
88+
return menuAnimator
89+
}
90+
91+
func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {
92+
return MenuTransitionAnimator(mode: .dismissal)
9093
}
9194
```
9295

@@ -100,7 +103,7 @@ P.S. We’re going to publish more awesomeness wrapped in code and a tutorial on
100103

101104
The MIT License (MIT)
102105

103-
Copyright © 2014 Yalantis
106+
Copyright © 2016 Yalantis
104107

105108
Permission is hereby granted, free of charge, to any person obtaining a copy
106109
of this software and associated documentation files (the "Software"), to deal

0 commit comments

Comments
 (0)