Skip to content

Commit 4a6cb59

Browse files
authored
Merge pull request #74 from handsomecode/develop
Updating and refining README
2 parents 1b09de7 + e3364f4 commit 4a6cb59

File tree

3 files changed

+48
-39
lines changed

3 files changed

+48
-39
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ DerivedData
1717
*.perspectivev3
1818
!default.perspectivev3
1919
xcuserdata
20+
*.orig
2021

2122
## Other
2223
*.xccheckout

README.md

Lines changed: 46 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,33 @@
1-
# Interactive Side Menu
2-
3-
[![Swift version](https://img.shields.io/badge/swift-3.0-orange.svg?style=flat.svg)](https://img.shields.io/badge/swift-3.0-orange.svg?style=flat.svg)
4-
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
5-
[![License](https://img.shields.io/hexpm/l/plug.svg)](./LICENSE)
1+
<p align="center">
2+
<a href="https://github.com/handsomecode/InteractiveSideMenu">
3+
<img src="Screenshots/InteractiveSideMenu.gif">
4+
</a>
5+
</p>
6+
<p align="center">
7+
<a href="https://swift.org/">
8+
<img src="https://img.shields.io/badge/swift-3.0-orange.svg?style=flat.svg" alt="Swift version: 3.0">
9+
</a>
10+
<a href="https://cocoapods.org/pods/InteractiveSideMenu">
11+
<img src="https://img.shields.io/badge/CocoaPods-2.1-green.svg" alt="CocoaPods: 2.1">
12+
</a>
13+
<a href="https://github.com/Carthage/Carthage">
14+
<img src="https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat" alt="Carthage compatible">
15+
</a>
16+
<a href="https://github.com/handsomecode/InteractiveSideMenu/blob/master/LICENSE">
17+
<img src="https://img.shields.io/hexpm/l/plug.svg" alt="License: Apache 2.0">
18+
</a>
19+
</p>
620

7-
iOS Interactive Side Menu written in Swift.
8-
9-
![sample](Screenshots/InteractiveSideMenu.gif)
21+
# Interactive Side Menu
22+
A customizable, interactive, auto expanding and collapsing side menu for iOS written in Swift.
1023

11-
It supports following customization:
24+
Here are some of the ways Interactive Side Menu can be customized:
1225
- Animation duration
1326
- Visible content width
1427
- Content scale
15-
- Using spring animation with params customization
16-
- Animation options like animation curve
17-
18-
All these parameters could vary for different orientations.
28+
- UIView spring animations
29+
- Animation curves
30+
- Customized animation settings for different orientations
1931

2032
## Communication
2133

@@ -27,35 +39,33 @@ All these parameters could vary for different orientations.
2739

2840
You can find more details into [CONTRIBUTING](./CONTRIBUTING.md) file.
2941

30-
# Installation
42+
## Installation
3143

32-
## CocoaPods
33-
To install it through [CocoaPods](https://cocoapods.org/), add the following line to your Podfile:
44+
### CocoaPods
45+
To install using [CocoaPods](https://cocoapods.org/), add the following line to your Podfile:
3446
```
3547
pod 'InteractiveSideMenu'
3648
```
3749
Please, don't forget to run `pod update` command to update your local specs repository during migration from one version to another.
3850

39-
## Carthage
40-
To install it through [Carthage](https://github.com/Carthage/Carthage), add the following line to your Cartfile:
51+
### Carthage
52+
To install using [Carthage](https://github.com/Carthage/Carthage), add the following line to your Cartfile:
4153
```
4254
github "handsomecode/InteractiveSideMenu"
4355
```
4456

57+
## Usage
58+
To implement your side menu you should subclasses the following view controllers: `MenuContainerViewController` and `MenuViewController`
59+
- `MenuContainerViewController` is the main container that hosts the side menu and content controller
60+
- `MenuViewController` is the container controller for the side menu
4561

46-
# Usage
47-
To implement your side menu you should create subclasses of basic View Controllers.
48-
- ```MenuContainerViewController``` is a host for menu and content views
49-
- ```MenuViewController``` is a container for menu view
50-
51-
Also, ensure that every menu item ViewController adopts relevant protocol.
52-
- ```SideMenuItemContent``` is a ViewController's protocol for data that corresponds menu item
62+
To add a new menu item, your view controller needs to conform to the `SideMenuItemContent` protocol.
5363

54-
## HostViewController implementation
55-
To setup your side menu you need to do three things:
56-
- Provide implementation of base ```MenuViewController``` and assing it to ```menuViewController``` property
57-
- Provide implementation of menu content and assing array of content controllers to ```contentViewControllers``` property
58-
- Select initial content controller by calling ```selectContentViewController(_ selectedContentVC: MenuItemContentViewController)```
64+
Setting up the side menu can be done in three steps:
65+
##### For this, Host = `MenuContainerViewController` subclass and Menu = `MenuViewController` subclass
66+
1. Assign Menu to the `menuViewController` property of Host
67+
2. Set the Host's `contentViewControllers` array with an array of `SideMenuItemContent` controllers
68+
3. Call `selectContentViewController(_ selectedContentVC: MenuItemContentViewController)` from Host
5969

6070
```swift
6171
import InteractiveSideMenu
@@ -79,7 +89,7 @@ class HostViewController: MenuContainerViewController {
7989
```
8090

8191
## Items content
82-
To show menu, call ```showSideMenu()``` method from `SideMenuItemContent` protocol.
92+
To show menu, call `showSideMenu()` from any `SideMenuItemContent` controller.
8393
```swift
8494
import InteractiveSideMenu
8595

@@ -91,7 +101,7 @@ class KittyViewController: UIViewController, SideMenuItemContent {
91101
}
92102
```
93103

94-
To change content view, choose desired content controller and hide menu.
104+
To change the currently visible controller, pass the desired controller to your `MenuContainerViewController`:
95105
```swift
96106
let index = 2 // Second menu item
97107
guard let menuContainerViewController = self.menuContainerViewController else { return }
@@ -119,7 +129,7 @@ class InnerViewController: UIViewController {
119129
Please, find UITabBarController implementation details in [Sample](./Sample).
120130

121131
## Animation Customization
122-
To customize animation for menu opening or closing, update ```transitionOptions``` property that is available in ```MenuContainerViewColtroller``` class. Initial setup could be done, for example, on controller's ```viewDidLoad()```.
132+
To customize the open and close animations, update the `transitionOptions` property on your `MenuContainerViewColtroller` subclass. The sample project does this in `viewDidLoad()`
123133
```swift
124134
override func viewDidLoad() {
125135
super.viewDidLoad()
@@ -129,7 +139,7 @@ override func viewDidLoad() {
129139
}
130140
```
131141

132-
Also, you have possibility to update customization settings, e.g. set another options for landscape orientation. To do it, override ```viewWillTransition(to:with:)``` mehod and add desired parameters to ```transitionOptions``` property.
142+
To customize transition options for different orientations, override `viewWillTransition(to:with:)` and update the `transitionOptions`. This can also be done with trait collections using `traitCollectionDidChange(_:)`
133143
```swift
134144
override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
135145
super.viewWillTransition(to: size, with: coordinator)
@@ -140,12 +150,10 @@ override func viewWillTransition(to size: CGSize, with coordinator: UIViewContro
140150
}
141151
```
142152

143-
Transition options could be used to set different parameters for Compact and Regular sizes as well. Implement ViewController's ```traitCollectionDidChange(_: )``` method to add these settings.
144-
145-
Use [Sample](./Sample) to see implementation details and [CHANGELOG](./CHANGELOG.md) to get more information about updating library from v1.0 to v2.0.
153+
Check out the [Sample](./Sample) project for more details and usage examples.
146154

147155
# Known Issues
148-
There is [an issue](https://github.com/handsomecode/InteractiveSideMenu/issues/53) associated with scaling of NavigationBar in iOS 11. Status bar background is hidden during side menu closing if `contentScale < 1`. It’s supposed to be *iOS 11* Navigation Bar issue that's been reported to Apple.
156+
There is [an issue](https://github.com/handsomecode/InteractiveSideMenu/issues/53) associated with the scaling of a UINavigationBar in iOS 11. Status bar background is hidden during side menu closing if `contentScale < 1`. This is an *iOS 11* issue and has been reported to Apple.
149157

150158

151159
# Requirements

Sources/MenuItemContentViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// MenuItemContentViewController.swift
2+
// SideMenuItemContent.swift
33
//
44
// Copyright 2017 Handsome LLC
55
//

0 commit comments

Comments
 (0)