From 1ef6aed46a025c4ba772b456ed27f8856311bd2a Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 7 Oct 2017 12:03:47 +0200 Subject: [PATCH 1/3] Fix headings and tables --- README.md | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index f3ee1ca..09f2223 100644 --- a/README.md +++ b/README.md @@ -35,12 +35,12 @@ Description 6. [Customisation](#customisation) 7. [Implementing custom transitions](#custom-transitions) 8. [Public interface](#public-interface) -9. [Delegation] (#delegation) +9. [Delegation](#delegation) 10. [License](#license) 11. [Contact](#contact) -## Features - + Features +-------------- - [x] Easy to use, fully customisable - [x] Left and Right side positioning @@ -120,10 +120,10 @@ If you prefer not to use either of the aforementioned dependency managers, you c You can get started using `SideMenuController` in 3 simple steps: -###Step 1 +### Step 1 First of all, you should **add a menu button image** and **specify the position of the side panel**. Optionally, you can customise other preferences as well. This can be achieved in two ways: -### 1) If the SideMenuController subclass is the initial view controller in your main storyboard: +#### 1) If the SideMenuController subclass is the initial view controller in your main storyboard: Subclass `SideMenuController` and override `init(coder:)` where you can change the preferences according to your own style: @@ -143,7 +143,7 @@ class CustomSideMenuController: SideMenuController { Next, go to the Storyboard, and change the class of the SideMenuController to the custom subclass you just created. -### 2) In all other cases: +#### 2) In all other cases: In `AppDelegate.swift`, override `application:didFinishLaunchingWithOptions:`: @@ -160,10 +160,10 @@ func func application(_ application: UIApplication, didFinishLaunchingWithOption ``` ⚠️_If you **do not** specify a menu button image, `SideMenuController` **will not add one by default** and you will have to manually add one whenever transitioning to a new center view controller._ -###Step 2 +### Step 2 `SideMenuController` can be used with storyboard segues, or you can programmatically transition to a new center view controller. -####Using storyboard segues#### +#### Using storyboard segues ``SideMenuController`` defines two custom segues: > - `SideContainmentSegue` - which transitions to a new side controller (triggers `embedSideController`)
@@ -174,7 +174,7 @@ In the storyboard file, add initially two segues from the `SideMenuController` s Remember to set all the appropriate attributes of each segue in the Attributes Inspector: | SideContainmentSegue | CenterContainmentSegue | -|----------|:-------------:|------:| +|:----------------------:|:-------------------------------:| | ![Example](https://raw.githubusercontent.com/teodorpatras/SideMenuController/master/assets/side_settings.png) | ![Example](https://raw.githubusercontent.com/teodorpatras/SideMenuController/master/assets/center_settings.png) | In order to embed the inital view controlles inside the `SideMenuController` you will have to call `performSegue(withIdentifier:sender:)`. Easiest way is to subclass `SideMenuController` and override `viewDidLoad`: @@ -187,7 +187,7 @@ override func viewDidLoad() { } ``` -####Programmatically#### +#### Programmatically You can perform all the above mentioned transitions programmatically, without using segues, by calling one of the two public methods: @@ -238,14 +238,14 @@ sideMenuViewController.embed(centerViewController: tabBarController) show(sideMenuViewController, sender: nil) ``` -###Step 3 +### Step 3 You're almost set now. Last step is to know how to transition to new center view controllers. **Important Note:** `SideMenuController` defines an extension to `UIViewController` in order to make it more accessible via the computed property `public var sideMenuController: SideMenuController?`. From any `UIViewController` instance, you can access the `SideMenuController` by typing: `self.sideMenuController`. This will return the `SideMenuController` if the caller is one of its child view controllers or otherwise `nil`. From here onwards, whenever the user selects an option in the side menu controller, you can easily perform the segue like so: -####Using storyboard segues#### +#### Using storyboard segues ```swift override func tableView(_ tableView: UITableView, @@ -254,7 +254,7 @@ override func tableView(_ tableView: UITableView, } ``` -####Programmatically#### +#### Programmatically ```swift override func tableView(_ tableView: UITableView, @@ -297,6 +297,7 @@ For a more detailed example, check the Example project. Customisation -------------- + In order to customise the `SideMenuController` appearance and behaviour, you can play with the `SideMenuController .Preferences` structure. It is split into three sub structures: * ```Drawing``` - encapsulates custom attributes specifying how ```SideMenuController``` will adjust its layout, positioning on screen. @@ -305,7 +306,7 @@ In order to customise the `SideMenuController` appearance and behaviour, you can | `Drawing` attribute | Description | -|----------|-------------|------| +|-----------------------|-----------------------| | `menuButtonImage` | In case this attribute is set, `SideMenuController` will add a button on the left or right side of the navigation bar of the center view controller (**in case it is a subclass of UINavigationController**) in order to trigger the slide animation. If the attribute is missing, or the center view controller is not a subclass of `UINavigationController`, you'll have to add the menu button by yourself to all the `UINavigationControllers` that will be embedded. | | `sidePanelPosition` | Specifies the positioning of the side panel. This attribute can take one of the four values: `.underCenterPanelLeft`, `.underCenterPanelRight`, `.overCenterPanelLeft`, `.overCenterPanelRight` | | `sidePanelWidth` | The width of the side panel. | @@ -313,14 +314,14 @@ In order to customise the `SideMenuController` appearance and behaviour, you can | `centerPanelShadow` | When the side panel is either `.underCenterPanelRight ` or `.underCenterPanelLeft` you can opt in or out to draw a side shadow for the center panel. | | `Animating` attribute | Description | -|----------|-------------|------| +|-------------------------|-----------------------| | `statusBarBehaviour` | The animating style of the status bar when the side panel is revealed. This can be:
**+** `.slideAnimation`: the status bar will be hidden using the `UIStatusBarAnimation.slide` animation
**+** `.fadeAnimation`: the status bar will be hidden using the `UIStatusBarAnimation.fade` animation
**+** `.horizontalPan`: the status bar will slide along with the center panel horizontally.
**+** `.showUnderlay`: a layer with the same color as the navigation bar will be displayed under the status bar | | `reavealDuration` | Reveal animation duration. | | `hideDuration` | Hide animation duration. | | `transitionAnimator` | `TransitionAnimatable` subtype which defines how the new center view controller will be animated on screen. | | `Interaction` attribute | Description | Discussion | -|----------|-------------|------| +|-------------------------|-----------------------|------------| | `panningEnabled` | Default value is `true` | When the side panel is positioned **under the center panel**, the panning is recognized on the center panel. When the side panel is positoned **over the center panel**, the panning is recognized on the side panel. | | `swipingEnabled` | Default value is `true` | There is **no swipe gesture recognizer** instantiated when the side panel is positioned *under the center panel*. When the side panel is positioned **over the center panel**, the swipe is going to recognized on the center panel. | | `menuButtonAccessibilityIdentifier` | Accessibility identifier to be set on the menu button. | @@ -355,7 +356,8 @@ For more examples, check `TransitionAnimator.swift`. Public interface -------------- -##Public methods## +### Public methods + ```swift /** Toggles the side pannel visible or not. @@ -388,7 +390,7 @@ public func embed(centerViewController controller: UIViewController, cacheIdenti ``` -##Public properties## +### Public properties | Property | Type | Description | |----------|-------------|------| From 48e3fcb134dfed0a415e71a0650512ff04db0119 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 7 Oct 2017 12:06:58 +0200 Subject: [PATCH 2/3] Fix code sample in readme --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 09f2223..2da1601 100644 --- a/README.md +++ b/README.md @@ -148,7 +148,7 @@ Next, go to the Storyboard, and change the class of the SideMenuController to th In `AppDelegate.swift`, override `application:didFinishLaunchingWithOptions:`: ```swift -func func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { +func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. SideMenuController.preferences.drawing.menuButtonImage = UIImage(named: "menu") @@ -156,6 +156,8 @@ func func application(_ application: UIApplication, didFinishLaunchingWithOption SideMenuController.preferences.drawing.sidePanelWidth = 300 SideMenuController.preferences.drawing.centerPanelShadow = true SideMenuController.preferences.animating.statusBarBehaviour = .showUnderlay + + return true } ``` ⚠️_If you **do not** specify a menu button image, `SideMenuController` **will not add one by default** and you will have to manually add one whenever transitioning to a new center view controller._ From 70bd8e8a851665aeb1fa62c59cdbac2093ff38ef Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 7 Oct 2017 12:23:28 +0200 Subject: [PATCH 3/3] Fix typos in readme --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 2da1601..ebe8183 100644 --- a/README.md +++ b/README.md @@ -198,7 +198,7 @@ public func embed(sideViewController: UIViewController) public func embed(centerViewController: UViewController) ``` -**Important Note:** In case you want the center view controller to be of different type than `UINavigationController`, you'll have to add the menu button to one/all of its children navigation controllers programmatically. `SideMenuController` defines an extension to `UINavigationController` in order to make it easy to do that. Just call `navigationController.addSideMenuButton()`. **Before calling that method, make sure the navigation controller is already embedded inside the `SideMenuController`'s child controller hierarchy.** +**Important Note:** In case you want the center view controller to be of a different type than `UINavigationController`, you'll have to add the menu button to one/all of its children navigation controllers programmatically. `SideMenuController` defines an extension to `UINavigationController` in order to make it easy to do that. Just call `navigationController.addSideMenuButton()`. **Before calling that method, make sure the navigation controller is already embedded inside the `SideMenuController`'s child controller hierarchy.** Example with `UITabBarController`: @@ -241,7 +241,7 @@ show(sideMenuViewController, sender: nil) ``` ### Step 3 -You're almost set now. Last step is to know how to transition to new center view controllers. +You're almost set now. The last step is to know how to transition to new center view controllers. **Important Note:** `SideMenuController` defines an extension to `UIViewController` in order to make it more accessible via the computed property `public var sideMenuController: SideMenuController?`. From any `UIViewController` instance, you can access the `SideMenuController` by typing: `self.sideMenuController`. This will return the `SideMenuController` if the caller is one of its child view controllers or otherwise `nil`. @@ -304,7 +304,7 @@ In order to customise the `SideMenuController` appearance and behaviour, you can * ```Drawing``` - encapsulates custom attributes specifying how ```SideMenuController``` will adjust its layout, positioning on screen. * ```Animating``` - encapsulates custom attributes specifying which animations will be used for different components. -* ```Interaction``` - encapsulates custom attributes specifying how the user is allowed to interract with the side panel +* ```Interaction``` - encapsulates custom attributes specifying how the user is allowed to interact with the side panel | `Drawing` attribute | Description | @@ -324,8 +324,8 @@ In order to customise the `SideMenuController` appearance and behaviour, you can | `Interaction` attribute | Description | Discussion | |-------------------------|-----------------------|------------| -| `panningEnabled` | Default value is `true` | When the side panel is positioned **under the center panel**, the panning is recognized on the center panel. When the side panel is positoned **over the center panel**, the panning is recognized on the side panel. | -| `swipingEnabled` | Default value is `true` | There is **no swipe gesture recognizer** instantiated when the side panel is positioned *under the center panel*. When the side panel is positioned **over the center panel**, the swipe is going to recognized on the center panel. | +| `panningEnabled` | Default value is `true` | When the side panel is positioned **under the center panel**, the panning is recognized on the center panel. When the side panel is positioned **over the center panel**, the panning is recognized on the side panel. | +| `swipingEnabled` | Default value is `true` | There is **no swipe gesture recognizer** instantiated when the side panel is positioned *under the center panel*. When the side panel is positioned **over the center panel**, the swipe is recognized on the center panel. | | `menuButtonAccessibilityIdentifier` | Accessibility identifier to be set on the menu button. | Implementing custom transitions