Skip to content

Commit fa68740

Browse files
authored
Update README file (#9)
* Update read.me file * Fix typo * Fix typo * Add CODEOWNERS
1 parent d3e6d7f commit fa68740

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Default code owner for this repo
2+
* @caiocoanyml

README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,49 @@ Documentation is automatically generated from source code comments and rendered
1313
Usage
1414
----------
1515

16+
To use `YSideMenu` in your app, you need to create an instance of `SideMenuController`, passing a child view controller as a parameter. Here is an example of how to create and present a side menu:
17+
```swift
18+
import YSideMenu
19+
20+
let sideMenuController = SideMenuController(rootViewController: contentViewController)
21+
present(sideMenuController, animated: true, completion: nil)
22+
```
23+
24+
### Customization
25+
`SideMenuController` has an `appearance` property of type `Appearance`.
26+
27+
`Appearance` lets you customize how the side menu both appears and behaves. You can customize:
28+
29+
```swift
30+
let contentViewController = ContentViewController()
31+
let sideMenuController = SideMenuController(rootViewController: menuViewController)
32+
sideMenuController.appearance = .init(
33+
dimmerColor: UIColor.black.withAlphaComponent(0.5),
34+
idealWidthPercentage: 0.75,
35+
maximumWidth: 300,
36+
isDismissAllowed: true
37+
)
38+
```
39+
40+
```swift
41+
appearance.presentAnimation = Animation(
42+
duration: 0.4,
43+
curve: .spring(damping: 0.6, velocity: 0.4)
44+
)
45+
46+
// Present the menu with a spring animation.
47+
present(sheet, animated: true)
48+
```
49+
50+
You can customize the appearance of the side menu by setting the `appearance` property of the `SideMenuController`. The `Appearance` struct contains the following properties:
51+
52+
`dimmerColor`: the color of the dimmer view that is displayed behind the side menu (default is black with an alpha of 0.3).
53+
`idealWidthPercentage`: the ideal width of the side menu as a percentage of the width of the screen (default is 0.75).
54+
`maximumWidth`: the maximum width of the side menu in points (default is 300).
55+
`isDismissAllowed`: a Boolean value that indicates whether the user can dismiss the side menu by tapping outside of it or by swiping it to the left (default is true).
56+
`presentAnimation`: present animation
57+
`dismissAnimation`: dismiss animation
58+
1659
Dependencies
1760
----------
1861

0 commit comments

Comments
 (0)